Hello all,

My first POI app generates a spreadsheet based on the Loan Calculator example provided. See snippet below.

Notice how all the values are hardwired in advance, not typed. The problem is that Excel complains about them (*). I can type new, identical values and their corresponding formats are acknowledged and applied by Excel (but only interactively): the numerical values become right-justified, the correct number of decimals is displayed, etc.

What statement should I add in order to tell Excel: "Upon opening the file, please apply the formats provided to the values inserted by 'setCellValue()'?

Perhaps I am doing things in the wrong order?

Bonus question: My spreadsheet looks better if seen at 85%. Can I specify such zoom factor inside the *.xlsx file?

Thx,

-Ramon

(*) I get the little upper-left triangle and the warning sign:
"The number in this cell is formatted as text or preceded by an apostrophe."

---------------------

        cell = row.createCell(2);
        cell.setCellValue("HS-114");
        cell.setCellStyle(styles.get("text"));

        cell = row.createCell(3);
        cell.setCellValue("40");
        cell.setCellStyle(styles.get("integer"));

        cell = row.createCell(4);
        cell.setCellValue("0.1875");
        cell.setCellStyle(styles.get("4-decimal_number"));

        cell = row.createCell(5);
        cell.setCellValue("17.88");
        cell.setCellStyle(styles.get("2-decimal_number"));




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to