# Word Export

With ActiveReports, you can render a report in Word format and control how the report is rendered to Word. Learn more in the documentation.

## Content

The [WordRenderingExtension](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.WordRenderingExtension.html) class renders your reports to the native Microsoft Word file formats. You can export Page reports and RDLX reports to **Microsoft Office Open XML (OOXML)** format (.Docx) or Word HTML format (.Doc) using the [FileFormat](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) property.

The Word HTML format (.Doc) provides greater layout accuracy for Page and RDLX Reports in Microsoft Word, on the other hand, OOXML format (.Docx) provides excellent editing experience for the exported reports.

The OOXML format (.Docx) is recommended in the following scenarios:

* **Open exported reports in a wide range of applications**: Users can open and modify the exported Word document in any of the following applications.
    * Microsoft Office 2013+
    * Microsoft Office for Mac 2016+
    * iWork and Pages for OS X (all supported versions)
    * LibreOffice
    * Google Quickoffice for Android
    * Documents Free (Mobile Office Suite) by SavySoda for iOS

    > type=note
    > **Note**: Besides the applications listed above, .Docx files exported through ActiveReports WordRenderingExtension class might work in other applications that support the .Docx format.
* **Customize reports after exporting**: Positioning and arrangement of report elements in the exported document is implemented using the OOXML format (.Docx) which provides a natural document flow for editing the exported documents.
* **Use Word automation features**: With support for automation features in the OOXML format (.Docx), tasks that previously required manual adjustments in the exported Word document are now handled automatically. Report elements such as page header and footer, expressions, heading levels, and table of contents are automatically transformed to the OOXML format (.Docx).
* **Set compatibility mode**: You can render a report as a Word document that is compatible with Microsoft Word 2007, 2010, or 2013 using the **DocumentCompatibleVersion** property from the export settings.
* **Retain page orientation and size when exporting RDLX report**: When exporting an RDLX report, the .Docx export retains the **PageSize** and **PaperOrientation** of each page in the report.

## Word Rendering Extension Properties

ActiveReports offers several options to control how reports render to Microsoft Word.

### Common properties (HTML and OOXML)

| Property | Description |
| -------- | ----------- |
| [Author](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the name of the author that appears in the Author field of the Properties dialog in the rendered Word document. |
| [Categories](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the name of the categories that appears in the Categories field in the Properties of the exported Word document. |
| [FileFormat](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the output file format to HTML (.Doc) or OOXML (.Docx). By default, the file format is set to HTML format. |
| [Title](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the title for a document that appears in the Title field of properties dialog in the rendered Word document. |

### HTML format

| Property | Description |
| -------- | ----------- |
| [BaseUrl](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the base URL for any relative hyperlinks that appear in the Hyperlink base field of the Properties dialog in the rendered Word document. |
| [Generator](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the identity of the document generator in the rendered Word document. |
| [PageHeight](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the height of the report pages in inches for the rendered Word document. The value in this property overrides the original settings in the report. |
| [PageWidth](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the width of the report pages in inches for the rendered Word document. The value in this property overrides the original settings in the report. |

### OOXML format

| Property | Description |
| -------- | ----------- |
| [CompanyName](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the name of the organization or company that appears in the Company field of Properties dialog in the rendered Word document. |
| [DocumentCompatibilityVersion](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the compatibility mode of the document to previous versions (Microsoft Word 2007 - 2013) of Word. By default, the compatibility version is set to Word2013. |
| [DpiX](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the horizontal resolution of the images in the rendered Word document. By default, DpiX is set to 96. |
| [DpiY](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the vertical resolution of the images in the rendered Word document. By default, DpiY is set to 96. |
| [PageOrientation](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets a value that specifies whether the document pages should be printed in portrait or landscape in the rendered Word document. |
| [PaperSize](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the paper size for the page. |
| [Password](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets a password that must be provided to open the rendered Word document. |
| [ReadOnlyRecommended](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets a value that indicates whether Microsoft Office Word displays a message whenever a user opens the document, suggesting that the document is read-only. |
| [WritePassword](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Sets the write password that is required for saving changes in the rendered Word document. |
| [TOCAutoUpdate](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.html) | Automatically updates the TableOfContents control while opening the Word document. By default, TOCAutoUpdate is set to False. |
| [FontEmbeddingMode](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Export.Word/GrapeCity.ActiveReports.Export.Word.Page.Settings.FontEmbeddingMode.html#GrapeCity_ActiveReports_Export_Word_Page_Settings_FontEmbeddingMode) | Sets a value that specifies how fonts are embedded in the exported DOCX file. The default value is Auto. |

## Interactivity

### HTML format

Reports rendered in a Word format supports both Bookmarks and Hyperlinks. However, if visibility toggling (like in a drill-down report) is essential to your report, it is recommended to use the HTML rendering extension. If a Document map is essential to your report, it is recommended to use the PDF rendering extension.

### OOXML format

* **Hyperlinks -** Hyperlinks on TextBox and Image controls are rendered as hyperlinks in Microsoft Word.
* **Bookmarks** \- Bookmarks in the report are rendered as Microsoft Word bookmarks\. Bookmark links are rendered as hyperlinks that link to the bookmark labels within the document\.
* **TOC AutoUpdate** \- TableofContents control in the report is rendered as a Microsoft Word table of contents\.

## Limitations

### HTML format

* Although background colors for controls export to Word documents, background colors for sections such as Body and Page Header or Footer do not.
* The **BackgroundImage** is not supported when used in TextBox and CheckBox controls embedded in data regions such as Table and Tablix.
* The **BackgroundImage** is not supported for reports, and for **List**, **Container**, **Shape**, **FormattedText**, **Table**, and **Tablix** report controls.
* **KeepTogether** property of Table/Tablix is not supported.
* Some FormattedText tags, for example \<b>bi\</b> and \<s>es\</s>, are not exported to Word.
* Image alignments other than the defaults (HorizontalAlignment: Left and VerticalAlignment: Top) are not supported.
* Checkbox color does not affect the color of the square.

### OOXML format

#### Report properties

* The **LineSpacing** property of a report's style sheet, **StartPageNumber** property of the report, **PrintOnLastPage** property of the PageHeader and PageFooter are not supported.
* For Page reports, some of the **NumberingStyle** property (**DocumentMap** settings) options are not supported. The supported **NumberingStyle** options are **Decimal**, **DecimalZero**, **LowerLetter**, **UpperLetter**, **LowerRoman**, **UpperRoman**.
* Background image is not supported for report item except Shape.
* The **BackgroundRepeat** property of the BackgroundImage is not supported in Page (Page reports) and Body (RDLX reports).
* For RDLX reports, **Background** and **Border** properties of Page Header or Page Footer are not supported.
* Microsoft Word calculates the width of the columns by the document width. an RDLX report calculates the width of the columns based on the body width, therefore, the width of columns in an exported RDLX report may differ from an original RDLX report.
* In Microsoft Word, the maximum supported page size is 22 inches (55.87 cm) wide and 22 inches (55.87 cm) high. If an exported report exceeds the maximum size, some data may be lost during export.
* In Microsoft Word, a table can have a maximum of 63 columns. If an exported report table has more than 63 columns, then the table is split and therefore an exported document may differ from an original report.
* A repeated Table Footer (the **RepeatOnNewPage** property of Table Footer) or multiple repeated headers on a single page are not supported.
* The **OverflowPlaceHolder** control is not supported.
* If the **PrintOnFirstPage** property of PageHeader or PageFooter is set to **False**, then both PageHeader and PageFooter will not be available on the first page of the exported document.
* The report data gets rendered only in the first theme if a Page report containing multiple themes is exported to Docx format.

#### Report controls

* The **Inset**, **Outset**, and **Windowsinset** border styles (in **BorderStyle** property) are not supported.
* The **Map**, **Chart**, **Image**, **Barcode**, **SparkLine**, **Bullet**, and **CustomControl** report controls are exported as an image. If a report control uses the BorderColor, BorderStyle or BorderWidth properties, a report is exported as a table.
* The **BorderWidth** property of report controls is not exported as-is and may differ from the original BorderWidth value.
* **PageBreaks** are not fully supported. The report contents exported to the Word's table or cell items do not support the page breaks.
* For **Shape** report control, if the **BorderStyle** property is set to **Double**, it is exported as Solid.
* For **Line** control, if **LineStyle** property is set to Double/Transparent, it is exported as Solid.
* For **BandedList** data region, only the BandedList Header is repeated on each page. The BandedList Footer, GroupHeaders and GroupFooters are not supported.
* **Tablix** data region is exported as a single table without horizontal split.
* For **Image** control, **Border** properties and **Padding** properties are not supported if the **Sizing** property is set to **Clip**.
* For **Container** report control, rounding corners (the **RoundingRadius** property) are not supported.
* **RepeatToFill** property for Table and Tablix is not supported.
* Images embedded in a Table data region are not properly supported.
* Pagination is not supported due to difference in the layouts of ActiveReports and Word.
* Page Number in Section (Page N of M(Section)) is not supported.
* **KeepTogether** property of Table/Tablix is not supported.
* Horizontal aligned images may overlap in iWord.
* The properties set to the 'Body' region of a Subreport are not exported.
* If a report contains overlapped report controls, these controls appear side by side in an exported Word document and not overlapped as in the Designer’s preview.

**FormattedText**

* FormattedText is exported as it is. It does not support all HTML and CSS features.
* The \<a> tag without a href attribute, \<abbr> and \<q> tags are exported as simple text.
* For Border Styles - Inset and Outset, the \<ul> tags are not exported.
* The **BackgroundColor**, **BackgroundImage**, **BorderColor**, **BorderStyle** and **BorderWidth** properties are not supported.
* Anchors with an href attribute are exported as hyperlinks.
* Headers like h1, h2, etc. are exported as corresponding Microsoft Word built-in header styles.

**TableOfContents**

* The **TextAlign**, **DisplayPageNumber**, **TextIndent**, and **Overline TextDecoration** properties are not supported.
* The **Source** property of the Document Map settings is not fully supported. Only the **Headings Only** option of the **Source** property is supported.
* If a report uses more than one TableOfContents controls, the properties of the first TableOfContents are applied to the other TableOfContents controls in the exported document.
* The **FillCharacter** property is exported as dots.
* The background of TOC control appears black on opening the exported file in LibreOffice.

**TextBox/CheckBox**

* If the **Format** property is set to **Numeric** or **Date,** the exported TextBox has the right alignment. Other Format values are exported with the left alignment.
* The **Transparent color** for text is exported as white.
* The **Underline** for numbered lists, Right-To-Left (RTL) option of the **Direction,** **Angle**, **ShrinkToFit,** and **Overline TextDecoration**
    properties are not supported.
* The action **Jump to report** is not supported.
* The **tb-rl** (vertical text) option of the **WritingMode** property is not supported. TextBoxes with the **WritingMode** property set to tb-rl are exported as lr-tb.
* The **NoWrap** option of the **WrapMode** property is exported as WordWrap.
* The **LineSpacing** property of an exported document will differ from the original report. This is because, in Microsoft Word, the line spacing is calculated by the font size value of a report control plus the line spacing value of a report control.
* For **CheckBox** control, the **CheckAlignment** property is exported as MiddleRight for TopRight, MiddleRight, and BottomRight options. Other CheckAlignment options are exported as MiddleLeft.
* **Paddings** exceeding 31 inches is exported as border spaces.
* **Right-To-Left** text direction does not work in the LibreOffice.
* On exporting to Word 2013, when the background (shading) and padding are applied to a paragraph, the padding is also applied to the background, so a gap between the border and the background appears on the left side of the paragraph.
* **CharWrap** property is not supported.
* The fields in a TextBox control are evaluated as follows:
    * PageNumber and TotalPages expressions are exported as special fields, evaluated by a text editor (Word or other).
    * The fields placed in Header or Footer are automatically evaluated.
    * The fields placed in the Body should be re-evaluated manually by clicking 'Update field' from the context menu.

## Export Report using Word Rendering Extension

The following steps provide an example of rendering a report in Word format (.doc or .docx).

1. Create a new or open an existing Windows Forms App in Visual Studio project.
2. Go to the Project Explorer, right-click the project and select **Add** \> **New Item.**
3. Select **ActiveReports 19 Standalone Report** \> **Add** and choose a report type, **RDLX**, **RDLX Dashboard**, or **Page** report and then click **Finish**.
4. Add a reference to **MESCIUS.ActiveReports.Export.Word** package in the project.
5. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form\_Load event.
6. Add the following code inside the Form\_Load event to render your report in .OOXML or .HTML file format.

> type=note
> **Note**: To export your report in Word HTML format (.Doc), change the **FileFormat** property option from OOXML to HTML format as shown.
> `wordSetting.FileFormat = GrapeCity.ActiveReports.Export.Word.Page.FileFormat.HTML`

#### To export a report in .Docx file format

```vbnet
Dim rptPath As New IO.FileInfo("..\..\..\Report1.rdlx")
Dim pageReport As New GrapeCity.ActiveReports.PageReport(rptPath)

Dim outputDirectory As New IO.DirectoryInfo("C:\MyWord")
outputDirectory.Create()

Dim wordSettings As New GrapeCity.ActiveReports.Export.Word.Page.Settings() With {
    .FileFormat = GrapeCity.ActiveReports.Export.Word.Page.FileFormat.OOXML,
    .CompanyName = "My Company",
    .DocumentCompatibilityVersion = GrapeCity.ActiveReports.Export.Word.Page.DocumentCompatibility.Word2010,
    .DpiX = 300,
    .DpiY = 300,
    .PageOrientation = GrapeCity.ActiveReports.Export.Word.Page.PageOrientation.Landscape,
    .PaperSize = GrapeCity.ActiveReports.Export.Word.Page.PaperSize.A4,
    .Password = "Open123",
    .ReadOnlyRecommended = True,
    .WritePassword = "Edit123",
    .TOCAutoUpdate = True,
    .FontEmbeddingMode = GrapeCity.ActiveReports.Export.Word.Page.FontEmbeddingMode.Full
}

Dim wordRenderingExtension As New GrapeCity.ActiveReports.Export.Word.Page.WordRenderingExtension()
Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(
    outputDirectory,
    IO.Path.GetFileNameWithoutExtension(outputDirectory.Name)
)
outputProvider.OverwriteOutputFile = True

pageReport.Document.Render(wordRenderingExtension, outputProvider, wordSettings)
```

```csharp
var rptPath = new System.IO.FileInfo(@"..\..\..\Report1.rdlx");
var pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);

var outputDirectory = new System.IO.DirectoryInfo(@"C:\MyWord");
outputDirectory.Create();

var wordSettings = new GrapeCity.ActiveReports.Export.Word.Page.Settings()
{
    FileFormat = GrapeCity.ActiveReports.Export.Word.Page.FileFormat.OOXML,
    CompanyName = "My Company",
    DocumentCompatibilityVersion = GrapeCity.ActiveReports.Export.Word.Page.DocumentCompatibility.Word2010,
    DpiX = 300,
    DpiY = 300,
    PageOrientation = GrapeCity.ActiveReports.Export.Word.Page.PageOrientation.Landscape,
    PaperSize = GrapeCity.ActiveReports.Export.Word.Page.PaperSize.A4,
    Password = "Open123",
    ReadOnlyRecommended = true,
    WritePassword = "Edit123",
    TOCAutoUpdate = true,
    FontEmbeddingMode = GrapeCity.ActiveReports.Export.Word.Page.FontEmbeddingMode.Full
};

var wordRenderingExtension = new GrapeCity.ActiveReports.Export.Word.Page.WordRenderingExtension();
var outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(
    outputDirectory,
    System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name)
);
outputProvider.OverwriteOutputFile = true;

pageReport.Document.Render(wordRenderingExtension, outputProvider, wordSettings);
```