Incorrect format when we convert an excel file as a PDF

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)

@rbalaji007,

Thanks for the sample files.

I checked the first issue a bit using your template file. I found first row is hidden but you are using AutoFitRows() method which unhides the row. So, either you should not use the following line;

item.AutoFitRows();

or use the following line instead:

//Ignore hidden rows
item.AutoFitRows(new AutoFitterOptions() { IgnoreHidden = true });

Using the above line will render PDF correctly for your needs.

We will be looking into your second issue and get back to you with more details.

@rbalaji007

For the second issue, if you manually save the source file to pdf in Microsoft Excel, you will find that some text are also not visable. Premier-EquipmentScheduleHorizontalView_Excel2016.pdf (230.1 KB).

You need to re-design your soure/template file to make all text be visable in the generated pdf file.

If there are still some issues comparing with the pdf file generated by Microsfot Excel, please highlight it