Hi everyone, to preface I know the Plumsail API exists but I don't have the option of procuring additional API's for my team or their projects.
I have a flow that populates a docx template from data in a sharepoint list. The docx template is a legal document that structures its contents using a numebred list as "sections" that each have sub-contents or sub-sections. Each sub-section of the numebered list can either be a lettered list, numbered list, or paragraph (or sets of paragraphs, tables, etc). Main sections of the document (numbered list) are meant to be added based on conditions detected by the flow (if element A is from country B, insert section N to a specific spot in the document); I am able to accomplish this part easily for most scenarios in my project.
The place I have trouble is where the sub-content of a conditionally added section does not match the sub-content of the sections above or below it. Specifically, Section Y has a paragraph as sub-content, where as sections X and Z have numbered lists as their sub-content. I do not have the option to change the ordering of the sections without significant administrative burden.
If all 3 sections were uniform, I would structure them with two repeating content structures, one in the main list and another in the sub-contents like the following, then populate them with array objects in flow. I have proven this to be doable and easy.
However, the end-result I need to achieve looks like the following: Based on a condition in the flow, section Y might or might not exist in the document. That is the point of the flow, how to manage the injection of this piece with the paragraph sub-text
Using a nested structure here as I showed initially won't work, because I cannot automatically prevent the formatting of section Y to be anything other than a list. I know that I can "trick" nested lists to look like paragraphs by changing the formatting of the bullets in the repeating content structure, however that is not an option here since the sections above and below need to be lists. Finally, the reason I am not using plain text content controls is because I need to maintain the numbering of the sections and the table of contents without manual intervention on the end-product.
Are there HTML, XML, JSON, etc plugins that I can utilize to write custom data to the document?
You could use the Parse JSON action to extract the data from the JSON data:
Parsing JSON in Microsoft FlowThen Enter custom value from the Parse JSON action into the column of template of Microsoft Word.
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the response @v-litu-msft , does your example utilize the repeating section content control in the word template? Your example looks like it uses plain text controls. Not sure if it would still scale as a list in word if you did it that way.
Also, when trying to instantiate my variable as an object, my flow fails. However it runs when it is an array. Additioanlly, what is the relevance of Address in your example?
Do you think that you could extend your example to populate a nested list in the word document like I described in my original post? I will spend some time today trying to take it there myself.
I guess I could use a little bit of an explanation on how you structured your word template to achieve my desired effect.