Page tree
Skip to end of metadata
Go to start of metadata


In the course of debugging, it can often be difficult to visualize the structure of documents as they are manipulated by WordApplication.

Our documentation has an overview of how WordApplication represents a Word document and how to insert elements using WordApplicationThis post provides a generalized function for displaying the structure of a document.

The code below provides a function "UnfoldDocument" which will produce a formatted text representation of the element hierarchy in a given Document. Output assumes a monospaced font and is suitable for writing to a plain-text file, printing to a console or inserting in a tag on an ASP.Net page.

To make use of this function, pass it a reference to a document object as shown:




  • No labels