Issue with Table header when exported as PDF

Hello Aspose Team,

When we tried to generate a PDF file through template/excel file, we faced an issue in the header of the table in the exported PDF. The header of the table that was expected to be displayed at the top of the page is instead being displayed in the middle of the table as seen in the screenshot.

Here is the sample Code

class Example {

    public static void main(String[] args) {
        FileInputStream io = new FileInputStream(new File("/home/asthapa/Pa-front/project/exportCheck/template1/fullTemplate.xlsx"));
        Workbook workbook = new Workbook(io);
        workbook.save("beforeCalculateFormula.pdf")
        workbook.calculateFormula();
        workbook.save("afterCalculateFormula.pdf")
    }

}

While further looking into this issue, we found out that this header issue is seen after execution of the workbook.calculateFormula()

Could you please look into this from your side? Please refer to the screenshots and sample template/Excel file.

issueScreenshot.png (26.5 KB)

fullTemplate.zip (204.7 KB)

@aasthapa,

Please try our latest version/fix: Aspose.Cells for Java v21.2.3 (attached).
aspose-cells-21.2.3.zip (7.1 MB)

I tested your scenario/ case using your sample code and template file with Aspose.Cells v21.2.3 and could not spot the issue. There are 294 pages in the output PDF and these look ok in the final output PDF. Could you try the suggested fix and if you still find the issue, kindly do provide details on which page or pages, you found your mentioned issues, you may also provide more comparison screenshots to highlight the issue. We will check your issue soon.

@Amjad_Sahi

This issue still replicates when I used the jar file that you provided (21.2.3) as well as the latest released aspose cell version (21.2).

When we directly save the template from Microsoft Excel in PDF format, the format is as expected i.e when the page breaks, the sub header i.e “Coverage Tier” is seen in the next page as the header. Please refer to this screenshot expectedPdf.png (22.7 KB) and the last table of page 7 and first table of page 8.
PDF file exported from excel: exportedFromExcel.pdf (1.8 MB)

But when the same template is exported as PDF through aspose, some tables are shifted randomly (refer to table with header “Division: Durham” (page 192)) which then causes the pages breaks to shift as well and the sub header is seen in the middle of the table like this Issue.png (64.4 KB)
PDF file: afterCalculateFormula.pdf (2.9 MB)

Note: Data in the later pdf file (afterCalculateFormula.pdf) is appearing from page 185. So please ignore all the other empty pages. This is expected.

Thanks,
Astha

@aasthapa,
We have observed the issue and logged it in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSJAVA-43405 - Issue with table header while converting Excel file to PDF

@aasthapa,
We can see all the row height in sheet “Display” is custom, and row height is 14.45. To get more consistent output as Microsoft Excel, is it possible that set all the row height in sheet “Display” to a value of a multiple of 0.75(e.g. 14.25)?

We will check if it is possible to set all the row height in sheet “Display” to a value of a multiple of 0.75(e.g. 14.25).

However, by the phrase “To get more consistent output as Microsoft Excel” it seems that it will not completely resolve the problem in all cases. Could you please let us know whether setting all the row height in sheet “Display” to a value of a multiple of 0.75(e.g. 14.25) will resolve the issue in all cases? Or, is there some issue in Aspose itself which is being investigated on your end?

@rubyshrestha,
Thank you for the feedback. We have logged it with the ticket and will consider it while working on this issue.

@rubyshrestha,

It seems that while calculating page breaks, Microsoft Excel does some magic scale in horizontal and vertical direction especially when row height is not a value of a multiple of 0.75. Currently, we can handle most of cases while row height is a value of a multiple of 0.75. If you find any page breaks issue in this case, you can report it to us.

@Amjad_Sahi

When we looked at the row height from one drive, the row height is 14.25 (OneDriveRowHeight.png (41.3 KB)) and yet the issue is still replicating. Would you please tell us which Microsoft excel version you are using to identify the row height as 14.45?

Also, when we resave the template from LibreOffice and save it by using “Use Microsoft Excel 2007-2013 XML Format” option (refer to this savedWithLibre.png (43.3 KB)) and use the above sample code, this issue is not seen.

With CELLSJAVA-43405 - Issue with table header while converting Excel file to PDF will aspose resolve the issue irrespective of the row height or would it still be dependent upon the row height to be a value of a multiple of 0.75 ?

1 Like

@aasthapa,
We have noted your comments and will share our feedback soon.

The row height defined in XML is 14.45, see screenshot: “rowHeight_InXML.png”.
We open your source file with Office 365 local application, it shows that the row height is 14.5, see screenshot: “office365_Application.png”. And row height can be changed 14.25 successfully.
We also try to open your file from OneDrive in Chrome, it does show that the row height is 14.25.
So please change row height in Office365 local application.

If row height is not a value of a multiple of 0.75, page breaks may be different with the one of Microsoft Excel. Currently we can not fix it.

office365_Application.png (71.7 KB)
rowHeight_InXML.png (855 Bytes)

Hello,
We would like to know if this has been fixed in the newer versions? If so, could you please provide the version details/name on which the issue has been fixed?

Thanks,
Astha

@aasthapa,
We are afraid that this issue is not resolved and we have suspended work on this issue as described above. You will be notified here once any update is available or progress is made in this regard.