ExcelLibrary - 尝试打开Excel电子表格时出现OutOfMemoryException

时间:2015-08-26 16:16:48

标签: c# excel exception out-of-memory excellibrary

尝试打开Excel电子表格时出错。我在Visual Studio 2015和Excel 2010中使用ExcelLibrary。我做错了吗?

第3行出错。

OutOfMemoryException was unhandled

An unhandled exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll Additional information: Array dimensions exceeded supported range.

1     string file = @"C:\\Users\user\Desktop\data.xlsx";

2     Workbook workbook = Workbook.Load(file);
3     Worksheet worksheet = workbook.Worksheets[0];
4     worksheet.Cells[2, 3] = new Cell(textBoxText.Lines[0].ToString());
5     worksheet.Cells[2, 4] = new Cell(textBoxText.Lines[1].ToString());
6     workbook.Worksheets.Add(worksheet);
7     workbook.Save(file);

0 个答案:

没有答案