简体   繁体   English

如何在C#中使用Syncfusion转换xls / xlsx文件

[英]How to convert a xls/xlsx file using Syncfusion in C#

I am getting the System out of memory exception. 我正在获取系统内存不足异常。 The size of my xls file is 357 mb. 我的xls文件大小为357 mb。 I am not sure what has to be configured to allow opening of heavy files. 我不确定必须配置什么才能打开较重的文件。

I'm refering to the documentation available on this website https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-conversion 我指的是该网站上提供的文档https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-conversion

The stacktrace is as below: stacktrace如下:

at Syncfusion.XlsIO.Parser.Biff_Records.BiffContinueRecordRaw.ExtractContinueRecords() at Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.ParseStructure() at Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRawWithArray.ParseStructure(DataProvider provider, Int32 iOffset, Int32 iLength, ExcelVersion version) at Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRaw.FillRecord(BinaryReader reader, DataProvider provider, IDecryptor decryptor, Byte[] arrBuffer) 在Syncfusion.XlsIO.Parser.Biff_Records.BiffContinueRecordRaw.ExtractContinueRecords()处Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.ParseStructure()处Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRawWithData.Inset, ExcelVersion版本),位于Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRaw.FillRecord(BinaryReader阅读器,DataProvider提供程序,IDecryptor解密器,Byte [] arrBuffer)

Please let me know if any information required. 如果需要任何信息,请告诉我。

Edit 2: Code 编辑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);

The line at which the exception occurs has been marked with asteriks 发生异常的行标有星号

We can reduce the usage of the memory consumption by using “ParseWorksheetsOnDemand” . 我们可以通过使用“ ParseWorksheetsOnDemand”来减少内存消耗的使用。 Please refer the UG for more details, we have also discussed similar issue in the forum . 请参考UG了解更多详细信息,我们还在论坛中讨论了类似问题。

For further validation please provide us your input document through the Direct-Trac, we will analyze it further and provide more details. 为了进一步验证,请通过Direct-Trac向我们提供您的输入文档,我们将对其进行进一步分析并提供更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM