简体   繁体   中英

smartXLS - sheetRangeToImage not working

I have this problem using smartXLS library for Java

I try to export the sheets of a workbook as .png images using the method

workbook.sheetRangeToImage(row1,col1,row2,col2,file)

The code I use is as follows:

private static void takeValuePics() throws Exception {
    WorkBook w = new WorkBook();
    w.read(XLS_PATH + DIF_FILE_NAME);
    int numSheets = w.getNumSheets();
    String out;
    for(int i=0;i<numSheets;i++) {
        w.setSheet(i);
        System.out.println(w.getNumber(1,1));
        w.setPrintGridLines(true);
        out = VAL_PATH + "values_" + w.getSheetName(i) + ".png";
        w.sheetRangeToImage(0,0,LOOPS,3,out);
    }

The constants are configured correctly and the file is read correctly. (The println() prints correct values)

The .png files are created but they are completely empty! Just white rectangles.

Does anybody know what's wrong?

Problem solved by the fantastic SmartXLS support team!

I forward their answer:

You need set the print scale,it use the print scale value when exporting range to image workBook.setPrintScale(100);

That was all! Hope this helps people in the future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM