WordWriter represents a Microsoft Word document as a tree, similar to how Word itself represents a document. Most types of elements used with WordApplication correspond to entities that exist in an actual Word document, with some exceptions. Here is the recursive tree structure that WordWriter uses:
Code Block |
---|
Document
|
|--Section
|
|--Paragraph
| |
| |--CharacterRun
| |
| |--InlineImage
| |
| |--Field (includes Hyperlinks and MergeFields)
| |
| |--Field Contents
| |
| |--(Recurses back to Paragraph subtree)
|
|
|--List
| |
| |--ListEntry
| |
| |-(Recurses back to Paragraph subtree)
|
|--Table
|
|-TableCell
|
|-(Recurses back to Section subtree)
|
The "Recurses back to ..." comments mean that the branch can continue with the same structure of elements as previously defined in the tree. For example, a TableCell can contain a Paragraph, List, and/or another Table, followed by the children those elements support, and so on.
As mentioned previously, not all elements in WordApplication correspond to actual elements in a Word document. For example, the Word file format does not have a list structure. A list item is simply a specialized paragraph with additional formatting. The List type was added to WordApplication to make it easier to work with lists programmatically.
By default, a new Document created using WordApplication.Create contains the following elements:
Code Block |
---|
Document
|
|--Section
|
|--Paragraph
|
|--CharacterRun
|