Description
Represents a Word document.
C#
vb.net
Remarks
To create a new document, use WordApplication.Create(). To open an existing document, use WordApplication.Open().
Note: Document inherits from Element and inherits a lot basic functionality from that class. Be sure to see the Element
API docs when looking for specific functionality.
Examples
C#
vb.net
Properties
Name |
Description |
---|---|
Sets or returns a Document.Autoformat object representing autoformat type for this document. Possible values: Normal, Letter, Email. | |
Returns a CompatibilitySettings object that can be used to get and set various settings that help Word display documents that were imported from earlier versions and competing products. | |
Returns a WordChangeTracking object that can be used to get and set the change tracking settings for this Document. | |
Returns a DateTime object representing the date this document was created. |
|
Returns a DateTime object representing the date this document was last printed using Word. |
|
Returns a DateTime object representing the date this document was last revised. |
|
Sets or returns an int representing the default tab width for this Document. The value that is returned is in twips. One twip = (1/20 pt) or ( 1/1440 in). |
|
Returns a Styles object that represents the properties of this document. | |
Returns a DocumentProtection object that can be used to get and set the protection settings that Word will apply to this document. (Only applicable to Word 2000 or above documents.) | |
Sets or returns a Document.Gutter object representing the gutter position in this document when it is opened in Word. If you have set up your document with facing pages or two pages per sheet (by using Mirror margins, Book fold, or 2 pages per sheet), then this option is not available. Possible values: Side, Top. | |
Returns a WordHyphenSettings object that can be used to get and set the hyphenation settings for this Document. | |
Sets or returns a boolean representing if Word will update the styles in the current document to match the styles in the attached Word template (i.e. Normal.dot) each time you open the document in Word. This should be set to true when you want to ensure that your document contains up-to-date style formatting. |
|
Returns an int representing the number of characters in this document. |
|
Returns an int representing the number of pages this document had when it was last opened in Word. |
|
Returns an int representing the number of paragraphs in this document. |
|
Returns an int representing the number of words in this document. |
|
Sets or returns a boolean representing if Word will only print the data inside a form field in this document. This is typically used to print the data entered into an online form without printing the online form. |
|
Sets or returns a boolean representing if the headers and footers should be different for odd and even pages, such as when the pages in this document will be mirrored. When set to true , it creates one header or footer for even-numbered pages and a different header or footer for odd-numbered pages. |
|
Sets or returns a boolean representing if Word will save only the data entered into a form field (instead of the field itself) for this document. When this is set to true , Word saves the data entered into an online form as a single, tab-delimited record so you can use it in a database. Word saves the file in Text Only file format. |
|
Returns an array of Section objects that represents all the sections in this Document. | |
Returns a Styles object that represents the Styles embedded in this document. | |
Sets or returns a boolean representing if widow control is in effect for this Document. |
|
Returns a WordViewSettings object that can be used to get and set various settings that pertain to how Word will display this document. | |
Returns a Watermark object representing an image or text that appears in the background of a printed document. |
Methods
Name |
Description |
---|---|
Appends an existing Document to the end of the current Document, separated by a next-page section break |
|
Returns a DataImportProperties object, which you can then use to set options for importing data into a table in a Word document. | |
Returns a Font object based on the font used by the Normal Style. You can then change the properties of this font and use it elsewhere. | |
Returns a ParagraphFormatting object based on the paragraph formatting used by the BodyText style. You can then change the properties of this font and use it elsewhere. | |
Returns a TableFormatting object that represents the table formatting used by the NormalTable style. | |
Returns a Bookmark object that represents the bookmark in this document that has the specified name. | |
Returns the document variable specified by name. | |
Sets the value of the variable with the specified name. If the variable does not exist, setVariable creates a new variable. If the variable does exist, setVariable overwrites the existing variable. |
Nested Classes
Name |
Description |
---|---|
A Document.Autoformat value specifies the type of AutoFormat settings to apply to a document. To select an AutoFormat type in Microsoft Word: | |
A Document.Gutter value specifies the position of a document's gutter margin. Gutter margins are used in documents that will be bound. A gutter margin is an extra margin on the top or side of the page that ensures that the text is not obscured when the document is bound. |