jdevelop
jdevelop

Reputation: 12306

JXLS2, XLSCommentBuilder and row overwrite white iterating over the passed collection

I have rather simple XLS template, and one of the rows is annotated with the comment on the cell A10:

jx:each(items="obj.reportRows" var="reportRow" lastCell="H10")

it works well - takes the collection and adds all the data from it, however it does overwrite some static cell data that is below the row A, instead of inserting the generated rows.

Looks like there's no attribute for the each command that controls whether the rows should be inserted or overwritten.

Am I missing something?

Upvotes: 2

Views: 1483

Answers (3)

SButterfly
SButterfly

Reputation: 11

Include all rows (table + static cells below table) into one big jx:area.

This will save static cells from disappearing.

Upvotes: 0

Justin A
Justin A

Reputation: 364

shiftMode="adjacent"

is what i add to my "each" command. I'll explain more...

For simple cases like this you can add a comment in your excel template at cell "A1" that represents the last row and column in your sheet. Lets say your last static cell is at M1 then you would add the following comment to cell "A1"

jx:area(lastCell="M10")

then you would change your "each" command to

jx:each(items="obj.reportRows" var="reportRow" lastCell="H10" shiftMode="adjacent")

This will insert the row as you would like without having to add "area" tags to static cells.

Upvotes: 0

Leonid Vysochyn
Leonid Vysochyn

Reputation: 1264

Try to include those static cells into jx:area tag.

In this case they should be shifted down as expected.

Upvotes: 1

Related Questions