We are encountering an issue when converting an Excel file to PDF using our licensed version of Spire.XLS 15.5.2. The process hangs indefinitely at the following line:
- Code: Select all
workbook.SaveToStream(outputStream, FileFormatXls.PDF);
Below is the relevant portion of our code:
- Code: Select all
string filePath = @"C:\path\to\your\file.xlsx";
var workbook = new Workbook();
workbook.LoadFromFile(filePath);
foreach (var worksheet in workbook.Worksheets)
{
worksheet.PageSetup.PaperSize = PaperSizeType.PaperA4;
worksheet.PageSetup.Orientation = PageOrientationType.Portrait;
worksheet.PageSetup.PrintArea = null;
worksheet.PageSetup.FitToPagesWide = 1;
}
workbook.ConverterSetting.SheetFitToWidth = true;
using var outputStream = new MemoryStream();
workbook.SaveToStream(outputStream, FileFormatXls.PDF);
return outputStream.ToArray();
This issue occurs only for one particular .xlsx file. All other files work as expected. Since this file may contain sensitive data, we are not comfortable sharing it on a public forum. Is there a way to share the file privately with your support team for investigation?
Thank you,