Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for nested lists #80

Open
hamedkvs opened this issue Nov 14, 2019 · 4 comments
Open

Support for nested lists #80

hamedkvs opened this issue Nov 14, 2019 · 4 comments

Comments

@hamedkvs
Copy link

hamedkvs commented Nov 14, 2019

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 secondLevel = new ArrayList<>();
}

public class Context {
String id;
List 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.

@t-oster
Copy link

t-oster commented Feb 16, 2021

I would also be interested in that feature. Nested repeats would be really great.

@gaffy94
Copy link

gaffy94 commented Apr 13, 2021

This would be a awesome feature guys

@t-oster
Copy link

t-oster commented Apr 13, 2021

If anyone would (crowd-?) fund it, I could probably implement this feature.

@caring-coder
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants