Work with documents

The topics in this section provide step-by-step procedures and code examples for using the object model of Microsoft Office Word to work with documents in Office projects.

In some cases, the ways that you perform these tasks in VSTO Add-ins is different from the ways that you perform them in document-level customizations.

Task Procedure
Create a document based on the Normal template or a different template. How to: Programmatically create new documents
Open a specified document as read/write or read-only. How to: Programmatically open existing documents
Close the active document or a specified document. How to: Programmatically close documents
Save a document with the same name or a new name. How to: Programmatically save documents
Print an entire document or only the current page. How to: Programmatically print documents
Display the print preview for a document. How to: Programmatically display documents in Print Preview
Display a built-in dialog box and collect user input. How to: Programmatically use built-in dialog boxes in Word
Use functionality in a built-in dialog box without displaying it. How to: Programmatically Use Word dialog boxes in hidden mode
Add a picture or Word Art to a document. How to: Programmatically add pictures and Word art to documents
Prevent users from editing a document or a part of a document. How to: Programmatically protect documents and parts of documents
Check spelling. How to: Programmatically check spelling in documents
Add a header or footer to a document. How to: Programmatically add headers and footers to documents
Remove all comments from a document. How to: Programmatically remove all comments from documents