Excel转pdf格式有问题

java版本,excel转pdf格式有问题,excel见附件文件.zip (8.9 KB)

@kongc,

I checked your template Excel file by opening the file into MS Excel and found there is (little) printable area set (i.e., “E1”). That’s why you are getting only single cell in the output PDF file. If you need to save all the contents/data with formattings to PDF, you got to remove that unnecessary printable area set in the sheet. See the following sample code that works fine as I tested:
e.g.
Sample code:

Workbook workbook = new Workbook("f:\\files\\背调明细.xlsx");
 Worksheet worksheet = workbook.getWorksheets().get(0);
 //Clear the print area
 worksheet.getPageSetup().setPrintArea("");
workbook.save("f:\\files\\out1.pdf");

Hope, this helps a bit.