You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a document template where a list of bullet points is created from dynamic data. The problem is that I can't find a way to do a #foreach loop which doesn't either a) put all content in one bullet point or b) end up with either extra bullet points or extra spacing
What I've Tried
Putting it into the list item like this
and the result was all names on one line, like this
I thought the solution might be to put the #end onto a new bullet point so the bullet got repeated
which got me closer but I end up with an additional empty bullet point for the #end merge field.
So I thought I'd try moving the loop outside the list item
but that ends up with multiple lists
I've then tried fiddling around with the paragraph spacing before and after in Word itself to see whether that would do it, but I can't get to the point where it looks like it would if you typed it in Word, i.e.
Analysis
I assume this is an issue similar to the one with table rows where the loop needs to be moved outside the LI but I can't find an option similar to the @before-row / @after-row stuff for list items. One solution I can think of (which would probably be generically useful) would be to remove an element from the generated output DOCX if the only thing in that input element is a merge field - that way you don't end up with extra elements solely because of the #foreach merge fields.
That would also solve some of the problems with merge fields creating extra white-space in the output document.
The alternative might to to implement the solution used by https://github.com/thombergs/docx-stamper which is to use comments to store the expressions rather than merge fields
Questions
Am I missing any obvious way to create bullet points in a loop?
Is there any way to avoid XDocReport creating paragraphs in the output docx for merge fields which are simply there for control flow i.e. the #foreach merge fields?
How might I go about making the @before-row / @after-row stuff work with list items?
The text was updated successfully, but these errors were encountered:
Description
I'm trying to create a document template where a list of bullet points is created from dynamic data. The problem is that I can't find a way to do a #foreach loop which doesn't either a) put all content in one bullet point or b) end up with either extra bullet points or extra spacing
What I've Tried
Putting it into the list item like this
and the result was all names on one line, like this
I thought the solution might be to put the #end onto a new bullet point so the bullet got repeated
which got me closer but I end up with an additional empty bullet point for the #end merge field.
So I thought I'd try moving the loop outside the list item
but that ends up with multiple lists
I've then tried fiddling around with the paragraph spacing before and after in Word itself to see whether that would do it, but I can't get to the point where it looks like it would if you typed it in Word, i.e.
Analysis
I assume this is an issue similar to the one with table rows where the loop needs to be moved outside the LI but I can't find an option similar to the @before-row / @after-row stuff for list items. One solution I can think of (which would probably be generically useful) would be to remove an element from the generated output DOCX if the only thing in that input element is a merge field - that way you don't end up with extra elements solely because of the #foreach merge fields.
That would also solve some of the problems with merge fields creating extra white-space in the output document.
The alternative might to to implement the solution used by https://github.com/thombergs/docx-stamper which is to use comments to store the expressions rather than merge fields
Questions
The text was updated successfully, but these errors were encountered: