Aspose Cells SheetRender incorrect page count

Hello,

I have here a sample where the behavior on Windows vs Linux is consistent. I’m using the newest Aspose Cell 23.12 version.

On Linux, total SheetRender count is 100 but on Windows, it is only 38.
Additional info: Aspose Cells version 22.12 output 100 on both Windows and Linux.

Sample code:

using(var workbook = new Aspose.Cells.Workbook(inFile))
                {
                    workbook.AcceptAllRevisions();
                    workbook.CalculateFormula();

                        // Apply different Image and Print options
                        var options = new ImageOrPrintOptions
                        {
                            OnePagePerSheet = false,                
                            ImageType = imageType,
                            PrintingPage = PrintingPageType.Default 
                        };

                        var count = 0;
                        foreach(var sheet in workbook.Worksheets)
                        {
                            if(sheet.Cells.Count == 0)
                                sheet.Cells["A1"].PutValue(" ");
                            var sr = new SheetRender(sheet, new ImageOrPrintOptions());

                            count += sr.PageCount;
                        }
                        Console.WriteLine($"Page: {count}");
                }

f359883e9dd04c2e928ed704c767ed6a.zip (380.2 KB)

@dunghnguyen
By using v23.12 and v22.12 for testing on a Windows machine, we can obtain the same results, both of which were 38 pages. Please check the attachment (46.2 KB).

Hello John, can you test on Linux as well? Linux yields 100 pages for me in which the missing 62 pages are blank pages. Thank you!

@dunghnguyen

We tested your code with Aspose.Cells 22.12 and 23.12 on Linux, the output are both 38 pages.
Please share us the sample runnable project which you run on Linux.

@dunghnguyen
Please check whether the font “AcadNusx”,“Sylfaen” are installed and it can show the “ინკასატორი”
And please set correct font for them for 宋体 can not be applied to “ინკასატორი”
If you do not set region, the default font of the fine is Calibri. Has Calibri been installed ?

I’ve made a mistake in the code snippet provided above, please use this to debug instead. Thank you

using(var workbook = new Aspose.Cells.Workbook(inFile))
{
    workbook.AcceptAllRevisions();
    workbook.CalculateFormula();
                        ImageType imageType = imageType.jpeg;

                        var options = new ImageOrPrintOptions
                        {
                            OnePagePerSheet = false,                // If you want entire sheet as a singe image
                            ImageType = imageType,
                            PrintingPage = PrintingPageType.Default // Set printing page type
                        };

                        var count = 0;

                        foreach(var sheet in workbook.Worksheets)
                        {
                            if(sheet.Cells.Count == 0)
                                sheet.Cells["A1"].PutValue(" ");
                            var sr = new SheetRender(sheet, options);

                            for(int j = 0; j < sr.PageCount; j++)
                                ++count;
                        }
                    
                    // Check for value of count here
}

The value of variable count is different on 22.12 as oppose to 23.12.

We do have AcadNusx and Calibri installed but not AcadNusx. Still, we don’t see how this is relevant to the discrepancy 38 vs 100 on Aspose.Cells 22.12 vs 24.12.

@dunghnguyen ,

we tested your updated code with Aspose.Cells 22.12 and 23.12 on Linux, the output are also 38 pages. Please make sure the source file is same as you shared here.

Also, you can save to pdf at the end, and share us the output pdf files generated on your Windows and Linux with Aspose.Cells 23.12 and 22.12.

using(var workbook = new Aspose.Cells.Workbook(inFile))
{
    workbook.AcceptAllRevisions();
    workbook.CalculateFormula();
    ImageType imageType = imageType.jpeg;

    var options = new ImageOrPrintOptions
    {
        OnePagePerSheet = false,                // If you want entire sheet as a singe image
        ImageType = imageType,
        PrintingPage = PrintingPageType.Default // Set printing page type
    };

    var count = 0;

    foreach(var sheet in workbook.Worksheets)
    {
        if(sheet.Cells.Count == 0)
            sheet.Cells["A1"].PutValue(" ");
        var sr = new SheetRender(sheet, options);

        for(int j = 0; j < sr.PageCount; j++)
            ++count;
    }

    // Check for value of count here

    //save to pdf
    workbook.Save("output.pdf");
}

Hi, can you please compare Aspose Cells 22.1 vs Aspose Cells 24.12 on Windows and Linux? Thank you

@dunghnguyen
By testing with sample code on versions v22.1 and v24.2, we can see that it is 100 pages on v22.1 and 38 pages on v24.2.

Thank you, can you please explain the rationale behind the differences and also justify which version is correct. Thank you so much!

@dunghnguyen ,

Actually, your source file is 36 pages in Excel printview. We are moving forward to match the Excel output.

So will there be a ticket open to address this issue?

@dunghnguyen
Through testing, we are able to reproduce the issue. There is a slight difference between the number of pages obtained by SheetRender and Excel.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-55238

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like