Open aiden-less opened 2 years ago
Please use the PageSetup.customPaperSize() method with the most recent version/fix: Aspose.Cells for Java v22.6 for your needs. Please see the following code for your reference. e.g. Sample code:
//Create workbook
Workbook workbook = new Workbook("f:\\files\\Book1.xlsx");
//Access first worksheet
Worksheet ws = workbook.getWorksheets().get(0);
//Set custom paper size, you need to convert cm to inches
ws.getPageSetup().customPaperSize(1.97,5.9);
//Save it as pdf
workbook.save("out1.pdf");
When excel is converted to PDF, the default paper size is A4. How can I realize the custom size (such as 15cm*5cm)?