We are using Aspose Cells 23.1 with JDK version 8 on CentOS 7.
In converted PDF,
Page footer is overwriting the text on first page
Adding extra pages with blanks rows at the end.
Earlier I was using the setting opt.setOnePagePerSheet(true);
Now we don’t want one page per sheet, it should split sheet into different pages.
Q. Is there any criteria to split the sheet in pages (like X no of rows in one page)?
Please note that, I have generated this with my test program without setting license thats why it is showing evaluation header.
@rutuja.mahajan
1,Can you share the locale setting of the machine that created this file ?
The default row height is strange 14.4pt in the file.
Could you resave the file in MS Excel, then export to pdf?
2, Adding extra pages with blanks rows at the end.
If you print the file in MS Excel, you will see same pages with blank rows.
In the mean time, after an initial test, we reproduced the issue with Input.xlsx file you mentioned. We found page footer is overwriting the text on first page.
To evaluate/investigate your issue, 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): CELLSJAVA-45099
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.
You can use page breaks feature to split your number of rows to be rendered on a page.
The row height in the source file is auto height, the cached height is 14.4 pt, when you open the source file in Excel, Excel auto re-calculates the row height to 15 pt, please use the code Worksheet.auotFitRows(true) to do the same thing.
Also, please move FontConfigs.setFontFolders to the start.
So the code will be:
public static void main(String args[]) {
String[] fontFolders = {"user/share/fonts",};
FontConfigs.setFontFolders(fontFolders, true);
try {
// Save the document in PDF format
Workbook workbook = new Workbook("C:\\Workspace\\workspace\\PRV-PA-ITP-00014.xlsx");
WorksheetCollection col = workbook.getWorksheets();
PdfSaveOptions opt = new PdfSaveOptions();
// opt.setOnePagePerSheet(true);
for (int i=0; i<col.getCount(); i++) {
Worksheet sheet = workbook.getWorksheets().get(i);
sheet.autoFitRows(true);
sheet.getPageSetup().setPrintArea(null);
}
workbook.save("C:\\Workspace\\workspace\\PRV-PA-ITP-00014.pdf", opt);
} catch (Exception e) {
System.out.println("Exception: "+e);
}
}
Please manually save the source file to pdf in Excel and share it to us. Also, highlight the issue and share us screenshots.
By setting autoFitRows now footer is not overriding the text.
If I manually save the excel in PDF it is also adding the extra blank pages at the end, do we have any solution to avoid this?
Also, If we don’t set the onePagePerSheet property, it is creating problem for CAD drawings, it just splits the drawing in multiple pages,
Can you check these attachment, Excel_With_CAD.zip (719.8 KB)
Hi,
For page break feature I need to define cells value (eg. Y30), which is not a dynamic solution.
If I don’t provide page break and If I don’t set onePagePerSheet, what is default criteria to split a sheet in pages?
Page breaks should be same as you see in Excel page break view(or in Excel printview).
If there are difference, please share us the source file and your code.
Thanks for the source files and sample code segment.
We will evaluate your issue soon. We also appreciate if you could share some screenshots to highlight the problematic areas (while comparing Excel’s print preview vs. output PDF pages (by Aspose.Cells). This will help us to evaluate your issue precisely. Please remove printable areas for the sheets in MS Excel manually before taking the print previews.
Your source files have fit to page wide/tall set and printarea set, if you clear the printrea, the sheet zoom will be different, so the page breaks will be different.
So if you clear the printarea in code, you should also clear printarea manually in Excel for comparing pagebreaks.
If you still have issues, please share us your current code and the sreenshots to highlight the page break issues.