# Document Properties

DsWord allows you to set or get the document properties such as body, list templates, document styles, theme, and settings. Learn more in DsWord docs.

## Content

Apart from content, a Word file holds some additional information in the form of document properties. These properties define various attributes of document as a whole.
DsWord provides following document properties through the GcWordDocument class:
**Body**
DsWord allows you to access the body of the document using the [Body](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.GcWordDocument.Body.html) property, which contains the text that excludes headers, footers, footnotes, text boxes, etc.
**List Templates**
DsWord provides the [ListTemplates](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.DocumentBase.ListTemplates.html) property to get a collection of list templates in the document.
**Document Styles**
DsWord allows you to access the collection of styles defined in the document using the [Styles](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Run.Style.html) property.
**Theme**
DsWord provides the [Theme](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.GcWordDocument.Theme.html) property to get a theme that holds all the different formatting options available to a document through the theme.
**Settings**
DsWord provides the [Settings](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.DocumentBase.Settings.html) property which gives you options to control various settings of a Word document, such as:

* **Compatibility options**: These options influence how the document content appears and are handled using the [CompatibilityOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.CompatibilityOptions.html) class which can be accessed using [CompatibilityOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.CompatibilityOptions.html) property of the [Settings](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.html) class.
* **View Options**: These options in Word documents lets you control the view and layout of a document. They are handled through the [ViewOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ViewOptions.html) class which can be accessed using [ViewOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.ViewOptions.html) property of the **Settings** class.
* **Hyphenation options**: These options are useful to render text in different marginal or justified settings by breaking words in between the lines to bring more consistency in text. The options are handled using the [HyphenationOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.HyphenationOptions.html) class which can be accessed using [HyphenationOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.HyphenationOptions.html) property of the **Settings** class.

![Hyphenated text in a Word document](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/hyphenation.png)

## Get Document Properties

To get the document properties, for example, compatibility mode and hyphenation options:

1. Get access to the document compatibility options using [Settings.CompatibilityOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.CompatibilityOptions.html) property.
2. Get the document compatibility mode using [CompatibilityMode](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.CompatibilityOptions.CompatibiltyMode.html) of the [CompatibilityOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.CompatibilityOptions.html) class. This will give you the version of Word document.
3. Get the maximum number of consecutive lines that can end with hyphens using [ConsecutiveHyphensLimit](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.HyphenationOptions.ConsecutiveHyphensLimit.html) property of the **HyphenationOptions** class.
4. Display the compatibility mode version and number of consecutive lines that can end with hyphens on the console.

    ```csharp
    doc.Load("SampleDoc.docx");
    
    //get document compatibility mode
    WordVersion version = doc.Settings.CompatibilityOptions.CompatibiltyMode;
    
    //Get the maximum number of consecutive lines that can end with hyphens
    ushort limit = doc.Settings.HyphenationOptions.ConsecutiveHyphensLimit;
    
    //Display the compatibility mode version on the console
    Console.WriteLine("\n WordVersion: " + version);
    
    //Display the maximum number of consecutive lines that can end with hyphens
    Console.WriteLine("\n consecutive lines ending with hyphens: " + limit);
    ```

## Set Document Properties

To set the document properties, for example, compatibility mode and hyphenation options:

1. Get access to the document compatibility options using **Settings.CompatibilityOptions** property.
2. Set the document compatibility mode using **CompatibilityMode** of the **CompatibilityOptions** class, which takes the value from the [WordVersion](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.WordVersion.html) enumeration.
3. Set the automatic hyphenation for the document using [AutoHyphenation](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.HyphenationOptions.AutoHyphenation.html) property of the **HyphenationOptions** class by providing a Boolean value.

    ```csharp
    doc.Load("SampleDoc.docx");
    
    //set document compatibility mode
    doc.Settings.CompatibilityOptions.CompatibiltyMode = WordVersion.Word2007;
    
    //Enable automatic hyphenation for the document
    doc.Settings.HyphenationOptions.AutoHyphenation = true;
    
    //Save the modifed Word file
    doc.Save("SetDocProperties.docx");
    ```

## Set View Options

**DsWord** provides various options to control how a document is displayed in an application through the [ViewOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ViewOptions.html) class, which can be accessed using the [ViewType](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ViewOptions.ViewType.html) property. It helps you display the page in different view modes such as master document view, draft view, outline view, print view and webpage view. DsWord also lets you set the zoom levels using the [ZoomType](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ViewOptions.ZoomType.html) property of the **ViewOptions** class. The different zoom modes available are **BestFit**, **FullPage**, **TextFit** and **None**. In addition, the ViewOptions class lets you specify the zoom percentage using the [Zoom](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ViewOptions.Zoom.html) property.
To set various viewing options, for example, view type, the zoom percentage and zoom type:

1. Access the viewing options using **Settings.ViewOptions** property.
2. Set the view mode using **ViewType** property of the ViewOptions class which accepts value from the [ViewType](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ViewType.html) enumeration.
3. Set the zoom value using **ZoomType** property of the ViewOptions class which accepts value from the [ZoomType](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ZoomType.html) enumeration.
4. Set the zoom percentage using **Zoom** property of the ViewOptions class.

> !type=note
> **Note**: Microsoft Word ignores these properties set through the ViewOptions class while displaying a document as it reads the properties directly from the Windows registry.

```csharp
doc.Load("SampleDoc.docx");

//set view type
doc.Settings.ViewOptions.ViewType = ViewType.Print;

//set zoom type
doc.Settings.ViewOptions.ZoomType = ZoomType.Fullpage;

//set zoom percentage
doc.Settings.ViewOptions.Zoom = 150;

doc.Save("ViewOptionsAdded.docx");
```

For more information on how implement document properties using DsWord, see [DsWord sample browser](https://developer.mescius.com/documents-api-word/demos/).