ExcelGrid - Export currency

4
I've created a piece of java code to export some data into Excel. I'm having troubles to export currency attributes. To be precise the export is working fine but I can't find a way to export currency data whitout having to convert the data into text. The result is that in Excel the values are shown as text. For example 39,00 in Mendix will be 39.0 in excel. Furthermore i can't set the celltype to currency in my java code (using mendix version 2.4.5), it's only possible to set boolean/nummeric and text. IMendixObject fileDoc = Core.create(this.getContext(), FactuurOverzicht.getType()); IExcelGrid grid = new ExcelGrid(); ... grid.getColumn(10).getCell(cellNr).setCellType(CellType.NUMERIC); grid.getColumn(10).getCell(cellNr).setContent(formatData(order.getTotaalPrijs())) The function formatDate is my own function and convert the double value into a string. And it prevents the null pointer exception. The only solution i can think of is the use of a different (open-source) library. Or am i missing something.
asked
1 answers
2

Now i'm trying to use the poi library. Like the following example... the lib is also installed with mendix.

HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("Facturatie");

    HSSFRow row = sheet.createRow((short)0);
    row.createCell((short)0).setCellValue("Datum gereed");
    row.createCell((short)1).setCellValue("Nummer");
    row.createCell((short)1).setCellValue("Totaalprijs");

    int rowNumber = 1;
    for (Order order: this.ordersTeFactureren){
        row = sheet.createRow((short)rowNumber);
        row.createCell((short)0).setCellValue(order.getDatumGereed());
        row.createCell((short)0).setCellValue(order.getNummer());
        row.createCell((short)0).setCellValue(order.getTotaalPrijs());

        rowNumber++;

    }
answered