# Render to DOCX or RTF

## Content

Set **<span class="code" spellcheck="false" data-prosemirror-content-type="mark" data-prosemirror-mark-name="code">C1WordDocument</span>** as the rendering target to generate DOCX or RTF output.
The following example renders the configured chart into a DOCX document.

```csharp
using C1.Chart;
using C1.Word;

// chart is an existing configured FlexChart or FlexDiagram.

using (var doc = new C1WordDocument())
{
    float margin = 72;
    float width = doc.PageSize.Width - 2 * margin;
    float height = (doc.PageSize.Height - 2.5f * margin) / 2;

    chart.Render(doc, margin, margin, width, height);

    doc.Save("Chart.docx");
}
```

The **[<span class="code" spellcheck="false" data-prosemirror-content-type="mark" data-prosemirror-mark-name="code">Save</span>](https://developer.mescius.com/componentone/api/win/online-wordlibrary/dotnet-framework-api/C1.C1Word.4.8/C1.C1Word.C1WordDocument.Save.html)** method determines the document format from the file extension.
To generate RTF output, specify the **`<span class="code" spellcheck="false" data-prosemirror-content-type="mark" data-prosemirror-mark-name="code">.rtf</span>`** extension.

```csharp
doc.Save("Chart.rtf");
```

or stream-based output, **<span class="code" spellcheck="false" data-prosemirror-content-type="mark" data-prosemirror-mark-name="code">C1WordDocument</span>** provides separate methods for saving DOCX and RTF documents.
The following example saves a DOCX document to an existing writable stream.

```csharp
doc.Save(stream, FileFormat.OpenXml);
```

To save the document in RTF format, use **<span class="code" spellcheck="false" data-prosemirror-content-type="mark" data-prosemirror-mark-name="code">SaveToRtf</span>**.

```csharp
doc.SaveToRtf(stream);
```

>type=note
> **Note:** The stream-based examples assume that the document and writable stream have already been created.