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