docx-stamper
docx-stamper copied to clipboard
Support for nested lists
Does docx-stamper support nested repeats? This is my scenario: I have a rather complex xml file which is supposed to feed the docx generator; this means the root object has multiple fields, some of which are of type List. These fields by themselves have some List fields and the nested structure of List elements (aka objects) could be of 6 levels or more. So, I tried to test docx-stamper for a simple two level nested List. Here is the model code (getters and setters are omitted for readability purposes here): `public class LevelTwo { String id; } public class LevelOne { String id; List<LevelTwo> secondLevel = new ArrayList<>(); }
public class Context { String id; List<LevelOne> firstLevel; }` I then created the sample data as follows: Context context; context.firstLevel having 3 elements (l1_1, l1_2 and l1_3) each of these elements themselves having 2 elements (l1_1_l2_1, l1_1_l2_2, l1_2_l2_1, l1_2_l2_2, l1_3_l2_1, l1_3_l2_2) the id of each element is the name of that element (e.g l1_2.id is l1_2)
In the produced docx I want to print all elements "id"s as follows: l1_1 l1_1_l2_1 l1_1_l2_2 l1_2 l1_2_l2_1 l1_2_l2_2 l1_3 l1_3_l2_1 l1_3_l2_2
I found out so far that it's possible to use a repeatParagraph on the text ${id} with the comment of repeatParagraph(firstLevel) which produces l1_1, l1_2 and l1_3 but I couldn't find a way to produce their children. As I said my model is way more complicated than this and some of the List elements are going to be replaced in tables, the inner elements of which will yield some other tables and a pattern like that continues. Any help would be appreciated. By a shallow consideration of docx-stamper so far, I have come to conclusion that I may need to thoroughly change how the expression evaluation (in comment processor) system works. If you think that this is the case, and docx-stamper currently doen't suit me, please give me some insights so that I can implement this functionality myself.
I would also be interested in that feature. Nested repeats would be really great.
This would be a awesome feature guys
If anyone would (crowd-?) fund it, I could probably implement this feature.
Nested comments has been implemented in our fork https://github.com/verronpro/docx-stamper, it at leas has been tested with repeatDocPart comment, but it should be working fine with other repeatParagraphs and repeatRows comments