SharpDocx
SharpDocx copied to clipboard
Is it possible to assemble documents?
Is there a relatively easy way to combine two or more documents into a final document?
I could just create one large template and use conditionals to control the display of paragraphs/pages. However, I'm wondering if it's possible to, for example, use logic in the Program.cs
or similar file to merge different templates as needed.
My scenario: I could have a full template with 10 parts. In many situations I may only need "x" of 10 of those parts (i.e., not all 10 parts). I'm wondering if I can control what parts need to be inserted into the final documents. So, I would consider having logic in the code to pick what I need from 10 separate templates and merging it into one final document.
Currently, I am using the former approach of using conditionals, but my template is a bit cumbersome.
@remesq did you ever figure this out?
I'm trying to figure our a clean way to have a generic header and footer for our generated documents, meaning the header and footer would essentially be it's own report, and then other documents would have the content which needs to be run through the template engine & merged :o
@remesq
I've done this, and I made a document generation platform!
You can use Open-Xml-PowerTools to combine docs
@jarodsmk
a generic header and footer
this is same above, you could use Open-Xml-PowerTools, It can handle header and footer.
Combining documents is not supported by SharpDocx, I would also use Open-Xml-PowerTools for this.