Message-ID: <567624601.2499.1710841153256.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2498_743545842.1710841153256" ------=_Part_2498_743545842.1710841153256 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Document

Document

Description

=20

Represents a Word document.

=20
C#
=20
 public sealed class Document : Element
=20
=20
vb.net
=20
Public NotInheritable Class Document
=09=09Inherits Element
=20
=20

Remarks

=20

To create a new document, use WordApplication.Create(). To open an existi= ng document, use WordApplication.Open().

=20

Note: Document in= herits from Element a= nd inherits a lot basic functionality from that class. Be sure to see the <= code>Element API docs when looking for specific functionality.

= =20

Examples

=20
C#
=20

          //--- Create a new Word document
          WordApplication app =3D new WordApplication();
          Document doc =3D app.Create();

          //--- Open an existing Word document
          WordApplication app =3D new WordApplication();
          Document doc =3D app.Open(@"C:\sample.doc");
        
=20
=20
vb.net
=20

          '--- Create a new Word document
          Dim app As New WordApplication()
          Dim doc As Document =3D app.Create()

          '--- Open an existing Word document
          Dim app As New WordApplication()
          Dim doc As Document =3D app.Open("C:\sample.doc")
        
=20
=20

Properties

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

AutoformatType

Sets or returns a Document.Autoformat object representing autoformat type = for this document. Possible values: Normal, Letter, Email.

CompatibilitySettings

Returns a CompatibilitySettings object that can be used to get and set v= arious settings that help Word display documents that were imported from ea= rlier versions and competing products.

ChangeTracking

Returns a WordChangeTracking object that can be used to get and set the cha= nge tracking settings for this Document.

DateCreated

Returns a DateTime object represent= ing the date this document was created.

DatePrinted

Returns a DateTime object represent= ing the date this document was last printed using Word.

DateRevised

Returns a DateTime object represent= ing the date this document was last revised.

DefaultTabWidth

Sets or returns an int representing= the default tab width for this Document<= /a>. The value that is returned is in twips. One twip =3D (1/20 pt) or ( 1/= 1440 in).

DocumentProperties

Returns a Styles object that represents the properties of this document.

DocumentProtection

Returns a DocumentProtection object that can be used to get and set the pro= tection settings that Word will apply to this document. (Only applicable to= Word 2000 or above documents.)

GutterPosition

Sets or returns a Document.Gutter object representing the gutter position in t= his document when it is opened in Word. If you have set up your document wi= th 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.

HyphenSettings

Returns a WordHyphenSettings object that can be used to get and set the hyp= henation settings for this Document.<= /td>=20

MergeStylesFromTemplate

Sets or returns a boolean represent= ing if Word will update the styles in the current document to match the sty= les 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.

NumCharacters

Returns an int representing the num= ber of characters in this document.

NumPagesOnLastOpen

Returns an int representing the num= ber of pages this document had when it was last opened in Word.

NumParagraphs

Returns an int representing the num= ber of paragraphs in this document.

Nu= mWords

Returns an int representing the num= ber of words in this document.

PrintDataInFormFields

Sets or returns a boolean represent= ing 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 withou= t printing the online form.

PrintFacingPages

Sets or returns a boolean represent= ing 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.

SaveDataInFormField

Sets or returns a boolean represent= ing if Word will save only the data entered into a form field (instead of t= he 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 fi= le format.

Se= ctions

Returns an array of Section objects that represents all the sections in this Document.=

Styl= es

Returns a Styles object that represents the Styles embedded in this document.<= /td>=20

UseWidowControl

Sets or returns a boolean represent= ing if widow control is in effect for this Document.

ViewSettings

Returns a WordViewSettings object that can be used to get and set various set= tings that pertain to how Word will display this document.

W= atermark

Returns a Wat= ermark object representing an image or text that appears in the backgro= und of a printed document.
=20

Methods

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

Append(Document)

Appends an existing Document to the end of t= he current Document, separated by a next-page section break

CreateDataImportProperties()

Returns a DataImportProperties object, which you can then use to set opti= ons for importing data into a table in a Word document.

CreateFont()

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.

CreateParagraphFormatting()

Returns a ParagraphFormatting object based on the paragraph formatting use= d by the BodyText style. You can then change the properties of this font an= d use it elsewhere.

CreateTableFormatting()

Returns a TableFormatting object that represents the table formatting used by = the NormalTable style.

GetBookmark(String)

Returns a Book= mark object that represents the bookmark in this document that has the = specified name.

GetVariable(String)

Returns the document variable specified by name.=

SetVariable(String, String)

Sets the value of the variable with the specifie= d name. If the variable does not exist, setVariable creates a = new variable. If the variable does exist, setVariable overwrit= es the existing variable.
=20

Nested Classes

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

= Autoformat

A D= ocument.Autoformat value specifies the type of AutoFormat settings to a= pply to a document. To select an AutoFormat type in Microsoft Word:

Gutt= er

A Docum= ent.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.
------=_Part_2498_743545842.1710841153256--