Render One PDF Page Per Excel Worksheet - Excel to PDF Conversion
Contents[ Hide ]
When working with large Microsoft Excel files (for example a workbook that has many sheets, each with 50 columns and 300 or more rows of data), you might want the PDF output to show one page per worksheet, regardless of the size of the worksheet. This would mean that each page is likely to have a radically different page size. This can be achieved by using Aspose.Cells for Java.
Please see the following sample code that converts an Excel file with multiple worksheets to PDF.
If the PdfSaveOptions.OnePagePerSheet option is set to true, all the sheet content is rendered to one PDF page. The paper size set by PageSetup is invalid, but the other settings set with PageSetup still take effect.
If your spreadsheet contains formulas, it is best to call the Workbook.calculateFormula method just before rendering the spreadsheet to PDF. This ensures that the formula dependent values are recalculated, and the correct values are rendered in the PDF.