1

I'm writing a small program using Mono and Aspose.Cells. I stack with the problem, that Aspose.Cell don't open 2 excel files in one project. Here is my code:

    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;
    }
nast90210
  • 11
  • 1

0 Answers0