Search code examples
javaexceltemplatesjxls

jXLS created Document: No calculating from the start


i created a tool, that analyzes a HTML Document and write the content of some tables in a Excel File. As you can see here it is very easy with jXLS to create a ExcelFile with a Template:

http://jxls.sourceforge.net/samples/tagsample.html

But I got one confusing problem: In the template XLS there is one cell, which calculates the sum of all rows in one column. When I open the created Excel File, it doens't calculate the sum. If I click on one cell in the column that should be calculated and press Enter, everything is fine. But is there a way, that I don't have to press enter?


Solution

  • Could you post the tags you've used? The SUM function in JXLS should be used like

    $[SUM(A1)]@0 or $[SUM(A1 + B1 + C1)]@0

    If you are using a foreach, the first example would be fine (A1 would be replaced by the actual cell values). Otherwise you'll need to use type 2.

    I can't imagine why pressing enter would cause the formula to be evaluated... JXLS tags are interpreted before the spreadsheet is written.