pantso14
pantso14

Reputation: 1

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?

Upvotes: 0

Views: 449

Answers (1)

pantso14
pantso14

Reputation: 1

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.

Upvotes: 0

Related Questions