在Mono上使用Aspose.Cells打开2个excel文件时出错

时间:2016-01-09 12:00:54

标签: c# excel mono aspose-cells

我正在使用Mono和Aspose.Cells编写一个小程序。我堆叠了问题,Aspose.Cell不在一个项目中打开2个excel文件。这是我的代码:

    protected string GetCellValue(string excelFileName, int row, int cell)
    {
        string cellValue = null;
        Workbook wb = new Workbook (excelFileName);
        Worksheet sheet = wb.Worksheets[0];
        if (sheet.Cells [row, cell].Value != null) {
            cellValue = sheet.Cells [row, cell].Value.ToString ();
        }
        sheet = null;
        wb.Dispose ();
        GC.Collect ();
        return cellValue;
    }

    protected static int GetRowCount(string anotherExcelFileName)
    {
        int count = 0;
        Workbook wb = new Workbook (anotherExcelFileName);
        Worksheet sheet = wb.Worksheets[0];
        count = sheet.Cells.Rows.Count;
        return count;
    }

0 个答案:

没有答案