【问题标题】:How to convert a xls/xlsx file using Syncfusion in C#如何在 C# 中使用 Syncfusion 转换 xls/xlsx 文件
【发布时间】:2019-02-21 13:16:33
【问题描述】:

我遇到系统内存不足异常。我的 xls 文件大小为 357 mb。我不确定必须配置什么才能允许打开重文件。

我指的是本网站上提供的文档https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-conversion

堆栈跟踪如下:

在 Syncfusion.XlsIO.Parser.Biff_Records.BiffContinueRecordRaw.ExtractContinueRecords() 在 Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.ParseStructure() 在 Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRawWithArray.ParseStructure(DataProvider 提供程序,Int32 iOffset,Int32 iLength,ExcelVersion 版本) 在 Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRaw.FillRecord(BinaryReader reader, DataProvider provider, IDecryptor decryptor, Byte[] arrBuffer)

如果需要任何信息,请告诉我。

编辑 2: 代码

ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
**IWorkbook workbook = application.Workbooks.Open(src_file, ExcelOpenType.Automatic);**
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);

发生异常的行已用星号标记

【问题讨论】:

  • 你能告诉我们你的代码吗?并指出发生异常的行?
  • @ChristianMurschall,我已经用代码更新了我的问题。

标签: c# syncfusion


【解决方案1】:

我们可以通过使用“ParseWorksheetsOnDemand”来减少内存消耗的使用。详情请参考UG,我们也在forum讨论过类似问题。

如需进一步验证,请通过 Direct-Trac 向我们提供您的输入文档,我们将对其进行进一步分析并提供更多详细信息。

【讨论】:

  • 嗨@mohan-chandran,我不确定,但这不起作用IWorkbook workbook = application.Workbooks.Open(src_file, ExcelOpenType.Automatic, ExcelParseOptions.ParseWorksheetsOnDemand);你能建议别的东西来打开沉重的文件吗?我认为我的测试用例之前指向了错误的文件。
猜你喜欢
  • 1970-01-01
  • 2012-09-06
  • 2016-06-22
  • 2013-05-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-09-25
  • 1970-01-01
相关资源
最近更新 更多