the generated excel doesn't start from first row if there are multiple if

26 views Asked by At

I am using jxls 2.14.0, I have an excel template which looks like following:

A1            A2            A3     -> row1
${b.a1}     ${b.a2}     ${b.a3}    -> row2
B1            B2            B3     -> row3
${b.b1}     ${b.b2}     ${b.b3}    -> row4
C1            C2           C3      -> row5
${b.c1}     ${b.c2}     ${b.c3}    -> row6

it has three parts : A, B and C, each time only one part will be generated.

for cell A1, I added:

jx:area(lastCell="C6")
jx:if(condition="type == 1", lastCell="C2" )

for cell ${b.a1}, I add jx:each(items="list" var="b" lastCell="C2")

for cell B1, I add jx:if(condition="type == 2", lastCell="C4" ), for cell ${b.b1}, I add jx:each(items="list" var="b" lastCell="C4")

for cell C1, I add jx:if(condition="type == 3", lastCell="C6" ), for cell ${b.c1}, I add jx:each(items="list" var="b" lastCell="C6")

if type == 1, then only part A will be generated and it starts from first row;

if type == 2, then only part B will be generated and it start from first row too.

but for part C, it starts from third row, first row and second row are empty row, why? how to make part C also start from first row?

0

There are 0 answers