We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The default font specified when transferring pictures seems useless

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)

@zyx,

We are not sure about your requirements and issue. Please elaborate it more and share more details with samples. Please note, “Arial” font cannot be used to show Chinese chars, so if you want to use Arial font instead of Chinese font, it will not show Chinese chars properly. We also appreciate if you could provide your desired output, so we could understand you better.