Tag: excell库

ExcelLibrary – 尝试打开Excel电子表格时发生OutOfMemoryException

试图打开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 […]

将空白DB值导出为Excell

我试图导出一个数据表,我从一个查询填充,但是我收到exception与最后一行消息“无效的单元格值”。 这只有在列包含空值时才会发生。 我怎样才能修改我的数据表来replace一个string的空值或作为空白空间在Excel文件中写入空值。 这是我有的代码: DataSet ds = new DataSet("New_DataSet"); DataTable dt = new DataTable("New_DataTable"); ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture; dt.Locale = System.Threading.Thread.CurrentThread.CurrentCulture; OracleDataAdapter adptr = new OracleDataAdapter(); try { con.Open(); var oracmd = con.CreateCommand(); oracmd.CommandText = "select Column1,Column2 from Test"; adptr.SelectCommand = oracmd; adptr.Fill(dt); con.Close(); ds.Tables.Add(dt); SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "Excell files (*.xls)|*.xls"; […]

打开excel文件时缓冲区不能为空错误?

我正在使用Excel库打开电子表格并阅读它的内容,我正在通过互操作库使用这个库,因为互操作库会导致我希望托pipe的服务器计算机上的问题。 https://code.google.com/p/excellibrary/ using ExcelLibrary.SpreadSheet; Stream fileStream = System.IO.File.OpenRead(excelFileName); //FilePath Workbook book = Workbook.Load(fileStream); //Exception thrown Worksheet sheet = book.Worksheets[0]; 运行代码时,您可以看到文件stream加载: 当我走到下一行时,我得到了exception。 缓冲区不能为空。 在stream读取器变成exception之后canRead false: