Document
The first thing to settle is whether you are building a document from nothing or working on one that already exists, because the two barely overlap.
Creating means document.New() and a sequence of AddParagraph, AddTable and
AddImage calls in the order the content should appear. Opening means
document.Open(), and then the problem is finding the part you want to change,
which is what the node API in Find and Edit Content is
for. A third case sits between them: opening a prepared template and filling in
its slots, covered in Templates and Mail Merge.
Whichever you are doing, defer doc.Close() belongs right after you get the
document.
Build a document
| Section | Covers |
|---|---|
| Simple Example | The shortest complete program. Start here. |
| Text | Runs, paragraphs, styles, spacing, borders and lists. |
| Page Layout | Page size, headers and footers, page numbers. |
| Links and Navigation | Hyperlinks, bookmarks, tables of contents. |
| Tables | Rows, cells, spans and page-break behavior. |
| Images | Pictures, text wrapping and watermarks. |
| Forms | The three form control mechanisms, and which to use. |
Work on an existing document
| Section | Covers |
|---|---|
| Find and Edit Content | Locating, replacing, removing, splitting and merging. |
| Comments and Revisions | Review markup and tracked changes. |
| Footnotes and Endnotes | Notes and their reference marks. |
| Templates and Mail Merge | Filling a prepared document with data. |
| Extracting Content | Reading text and properties back out. |
Output
| Section | Covers |
|---|---|
| Converting to PDF | Native conversion and the Word-driven OLE path. |
| Strict Mode | Writing strict OOXML rather than the transitional form. |
Last updated on