How can I customize paging for Excel converting to PDF

Now I have such a problem, I have a very big Excel, which contains several tables, each table is also very big, let’s say, the excel file has 8 tables, every table has 4,000 rows and 20 columns.

I want to customize the Excel 2 PDF, the PDF should be a single file and must contain all information of the Excel file, and every page of my PDF should has only 20 rows and 10 columns.

How can I implement it in Aspose Cells Java?

@zwei,

You may specify your desired print areas for the worksheet(s) of PageSetup before rendering to PDF. To set the printable area ranges in code, you may use PageSetup.setPrintArea attribute. See document for your reference.

Also, see the sample lines of code for your reference.
e.g.
Sample code:

Workbook book = new Workbook("Book1.xlsx");
//Get your worksheet (first for example)
Worksheet sheet = book.getWorksheets().get(0);
// set your desired printable area
sheet.getPageSetup().setPrintArea("A1:D10,F1:I10,K1:N10,A20:D30");
//....
//your code goes here
//....

Hope, this helps a bit.

1 Like