Hi,I am using Aspose Cells for Java 7.1.0 to convert excel worksheets to PNG(or jpeg) image. The problem is : Chinese charset is not correctly converted, The chinese characters are displayed with small empty squares.
It's ordinary when opened with MS Excel.
My OS is WindowsXP SP2.
===================================
This is my source code:
public class Excel2ImageTool {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// Creating an Workbook object with an Excel file path
Workbook workbook = new Workbook("C:\\book1.xls");
int cnt = workbook.getWorksheets().getCount();
System.out.println("Page Count: " + String.valueOf(cnt));
// Create an object for ImageOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
// Set the format type of the image
// imgOptions.setImageFormat(ImageFormat.getTiff());
// imgOptions.setTiffCompression(TiffCompression.COMPRESSION_CCITT_4);
imgOptions.setImageFormat(ImageFormat.getJpeg());
for (int i = 0; i < workbook.getWorksheets().getCount(); i++) {
// Get the worksheet.
Worksheet sheet = workbook.getWorksheets().get(i);
// Create a SheetRender object with respect to your desired sheet
SheetRender sr = new SheetRender(sheet, imgOptions);
for (int j = 0; j < sr.getPageCount(); j++) {
// Generate image(s) for the worksheet
sr.toImage(j, "C:\\images\\book1_sheet_" + i + "_page_" + j + ".jpg");
}
}
}
}