CellType.DATE is not written to a template

Issue #1 resolved
Georgi Stoyanov
created an issue

I have a cell in a template with value ${date}. "date" is a variable of type java.util.Date put in the context. When I transform the template:

public static final void generateXls(Map<String, Object> beans, InputStream fis, OutputStream fos) throws BiffException, IOException{
    Context context = new Context();
    for (Map.Entry<String, Object> entry : beans.entrySet()) {
        context.putVar(entry.getKey(), entry.getValue());

    //JxlsHelper.getInstance().processTemplate(fis, fos, context);
    Transformer transformer = CustomJexcelTransformer.createTransformer2(fis, fos);
    AreaBuilder areaBuilder = new XlsCommentAreaBuilder();
    List<Area> xlsAreaList = areaBuilder.build();
    for (Area xlsArea : xlsAreaList) {
                new CellRef(xlsArea.getStartCellRef().getCellName()), context);

// if( processFormulas ) { // setFormulaProcessor(xlsArea); // xlsArea.processFormulas(); // } }


...that cell type is set to Date, but the value is blank. I found the problem in JexcelCellData.java, function private WritableCell createWritableCell(int col, int row) {..}. There type date is omitted.

I added these likes starting from line 145:

        case DATE:
            writableCell = new DateTime(col, row, (Date)evaluationResult );

and it seems to work fine now. Can you add this to the official repo? I couldn't find a way to do it myself. Don't know if it is possible for me at all. Thanks!


Comments (3)

  1. Log in to comment