1

我正在使用 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;
    }
4

0 回答 0