public static void main(String[] args) throws Exception {
Workbook book = new Workbook(“978582-20210519失效-草稿线测试下载-14.xls”);
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.setImageType(ImageType.JPEG);
imgOptions.setDefaultFont(“Arial”);
imgOptions.setOutputBlankPageWhenNothingToPrint(false);
imgOptions.setHorizontalResolution(300);
imgOptions.setVerticalResolution(300);
final String filename = “aaa” ;
// Get the first worksheet.
final WorksheetCollection worksheets = book.getWorksheets();
for (int i = 0; i < worksheets.getCount(); i++) {
// Create a SheetRender object for the target sheet
final Worksheet sheet = worksheets.get(i);
sheet.getPageSetup().setPrintGridlines(true);
sheet.getCells().deleteBlankRows();
sheet.getCells().deleteBlankColumns();
SheetRender sr = new SheetRender(worksheets.get(i), imgOptions);
for (int j = 0; j < sr.getPageCount(); j++) {
// Generate an image for the worksheet
final String name = filename + “sheet” + (i+1) + “_” + (j+1) + “.jpg”;
sr.toImage(j, name);
}
}
}
I am sure my system has this font, my jdk is 1.8, and cells are 21.5
978582-20210519失效-草稿线测试下载-14.xls.zip (117.8 KB)