0

I am using JODConverter to convert an .xlsx file into a .pdf by following this sample code :

File inputFile = new File("document.xlsx");
File outputFile = new File("document.pdf");

// Create an office manager using the default configuration.
// The default port is 2002. Note that when an office manager
// is installed, it will be the one used by default when
// a converter is created.
final LocalOfficeManager officeManager = LocalOfficeManager.install(); 
try {

    // Start an office process and connect to the started instance (on port 2002).
    officeManager.start();

    // Convert
    JodConverter
             .convert(inputFile)
             .to(outputFile)
             .execute();
} finally {
    // Stop the office process
    OfficeUtils.stopQuietly(officeManager);
}

but I don't know how to convert a particular sheet / workbook ? I am looking something like getSheet(x) or getSheetName(x), but no success yet.

Any help ?

Tom Ang
  • 31
  • 3
  • Well, I found the answer by using the following : LocalConverter converter = LocalConverter .builder() .filterChain(new PagesSelectorFilter(4)) .build(); converter.convert(inputFile).to(outputFile).execute(); – Tom Ang Jun 18 '23 at 13:46

0 Answers0