I have an excel template, with two sheets. Both have a foreach, that prints some data in the final excel file. However, in the second sheet I need to have reference values in the first sheet that are inside foreach too.
So the problem, is that, jxls will transform the formulas in the second sheet as a range, and I want a direct relation. For example:
Sheet1
A1 --> <jx:forEach items="${departments}" var="department">
A2 --> ${department.name} | ${department.chief}
A3 --> </jx:forEach>
Sheet2
A1 --> 'Sheet 1'!A2
After processing data values, assuming we have 3 departments, I'll have something like:
Sheet1
A2 ---> department1
A3 ---> department2
A4 ---> department3
Sheet2
A2 ---> #VALUE (PROBLEM: This happens because jxls references 'Sheet 1'!A1:A3)
A3 ---> #VALUE (PROBLEM: This happens because jxls references 'Sheet 1'!A2:A3)
A4 ---> department3 (PROBLEM: In this case it works, because range one only element - 'Sheet 1'!A3:A3)
Is it possible to avoid or workaround this behaviour?
Thanks
You need use $[formula] to formula in jxls. In this case, the sheet2 in cell A1 should be $['Sheet 1'!A2].