This Java sample uses Qoppa’s PDF conversion library jOfficeConvert to convert the first worksheet from a Microsoft Excel workbook to PDF.
// Load the document ExcelDocument ed = new ExcelDocument("C:\\test\\input.xlsx", new ExcelConvertOptions()); List<String> worksheetNames = ed.getWorkSheetNames(); // Get the name of the first worksheet String sheet1Name = worksheetNames.get(0); // Tell the ExcelDocument to only convert sheet1 ed.setWorksheetsToConvert(Arrays.asList(sheet1Name)); // Save the document as a PDF file ed.saveAsPDF("C:\\test\\output.pdf"); |