When converting an Excel spreadsheet to PDF using jOfficeConvert, there are a few options that can be set through the ExcelConvertOptions class:

  • Option to create a bookmark for each worksheet
  • Option to set the layout of the page (fit to page, width or height)
  • Option to set a maximum number for the output PDF

Here is a sample code showing how to set the Excel conversion options, including information about the options possible values and default value:

// Create a new Excel conversion options
// with all default values
ExcelConvertOptions options = new ExcelConvertOptions();
// by default set create bookmarks is on and will create a bookmark for each worksheet
// using the worksheet name as the bookmark name
// this setting is to avoid creating a PDF with too many pages
// the conversion will stop once the output PDF has reached this max page number
// by default the max page count is set at 2000
// this is the output layout of the PDF based on the Excel worksheet
// the Paging.ActualSize, Paging.FitToPage, Paging.FitToWidth
// by default, paging it is set at Page.ActualSize
// load the Excel document
ExcelDocument excelDoc = new ExcelDocument("input.xlsx", options);
// save the document as a PDF file
excelDoc .saveAsPDF("output.pdf");

These options are used when opening the Excel file and will also apply when converting the Excel file to images or when sending it to the printer.