we are not able to convert a xlsx file to a pdf although our code works fine with other xlsx files.
Here is the code we are using. The xlsx file is attached. We are using dotnet 6.0 with the Syncfusion.XlsIORenderer.Net.Core 126.96.36.199 package.
using var excelEngine = new ExcelEngine();
var application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
using var fileStream = new MemoryStream(File.ReadAllBytes("PermissionsTimings.xlsx"));
var workbook = application.Workbooks.Open(fileStream);
var worksheet = workbook.Worksheets.First();
var renderer = new XlsIORenderer
ScalingMode = ScalingMode.Best
var settings = new XlsIORendererSettings
EmbedFonts = true
var doc = renderer.ConvertToPDF(worksheet, settings);
var pdfStream = new MemoryStream();
It seems to finish rendering after 10 minutes on my machine. But that's not a reasonable time. Either there is a way to improve performance with a trick or we need to cancel the task after say 30 seconds.
We are able to reproduce the reported issue at our end and validating it currently. We will share the validation details on January 6th, 2023.
Jan, we have confirmed the issue as Performance delay occurs while converting Excel with conditional formatting to PDF and logged a defect report. We will include the fix for this issue in our weekly NuGet release scheduled for January 17th, 2023.
You can track the status of defect report through below feedback link.
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
For now, as a workaround, we suggest you to enable the sheet calculations to reduce the time for conversion. Please find the code snippet below.
IWorkbook workbook = application.Workbooks.Open(excelStream);
Jan, we included the fix to resolve the issue Performance delay occurs while converting Excel with conditional formatting to PDF in our weekly NuGet release version 188.8.131.52. Kindly upgrade to this latest version and let us know if the reported issue is resolved.
Latest NuGet Package: https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core/184.108.40.206
thank you very much! Still takes a couple of seconds (30 seconds), but acceptable I guess. Considering it took 10 minutes before the fix this is highly appreciated.
Thanks for your valuable feedback, Jan. Please contact us if you require any other assistance.