OldVersion: Aspose.Cells.dll ( 2016 )
NewVersion: Aspose.Cells 22.2.0
The conversion of Excel to PDF is not looking good with latest version of Aspose Cells.
Please check the attached zip files …
Source Code:
Workbook workbook = new Workbook(filepath);
//Validate in case file is corrupted. Normally excel file should have at least 1 sheet
if (workbook.Worksheets.Any())
{
//Make all worksheet visible false except for first one for pdf conversion
// If there is any value in workSheetArray mark thse worksheet indexes as visible
//Item.Index starts at 0 so must add +1 to comapare with workSheetArray values
foreach (Worksheet item in workbook.Worksheets)
{
item.AutoFitRows();
item.IsVisible = workSheetArray == null || !workSheetArray.Any() ? item.Index == 0 : workSheetArray.Contains((item.Index + 1).ToString());
}
}
workbook.Save(convertedPdfTempFile, SaveFormat.Pdf); //used for debugging
var stream = workbook.SaveToStream();
return stream; //Used by calling application
Issue1.zip (77.7 KB)
Issue2.zip (200.5 KB)