We are currently investigating new ways to generate word documents.
We want to create a more powerful templating mechanism than the existing Mail Merge function, and something easier to use than LINQ Reporting Engine.
We are envisioning something like the following:
- the customer gives a sample word document to us. It has all the required styles and contains example data.
- We open the word document in a tool very similar to the Aspose Document Explorer.
- The Word document is shown as a tree of nodes.
- We can select “Run” Nodes and bind their content to our data. This will be used to transfer Field Level Data like Names or Adresses to the document
- We can also select other nodes like TableRow or Sections and replace them with a “for-each Expression”.
- for-each Nodes can be nested. This is not possible with Mail Merge.
steps 4, 5 and 6 mean that we need to “enrich” the word document with our own metadata. It is similar to enriching a HTML Template with *ngIf directives or binding expressions.
Because steps 3-6 are made in a custom “report designer” application, the “report designer” can provide intellisense. for example, because the “report designer” knows that the current Node is inside a foreach loop which iterates over customer objects, it can offer the properties of the customer class.
My questions are:
A) Does the Word Document Model have properties where such information can be stored? Like a string Property called “Tag” or “Reserve” where we can store these “enrichments”?
B) Or is there a way to identify Document Nodes? If a document node has dome sort of Identifier, then we could store this information in a document variable. For example
doc variable metadata = “ID123:foreach(customer c in myObj.Customers)”