# Getting Started with RadWordsProcessing

Use this article to build a small **RadWordsProcessing** sample that creates a `RadFlowDocument` in code and exports it to a `.docx` file. By the end of the tutorial, you will have a working project, the required packages and namespaces, and a document that you can open in Microsoft Word or another compatible editor.

> note
>
> If you still need to install **Telerik Document Processing**, see [First Steps in Using Telerik Document Processing](https://www.telerik.com/document-processing-libraries/documentation/getting-started/first-steps) for the available installation options.

Before you add code, make sure that your environment is ready:

1. Create a new .NET console application or open an existing project.
2. Install the packages listed in [WordsProcessing NuGet packages](https://www.telerik.com/document-processing-libraries/documentation/getting-started/installation/nuget-packages#wordsprocessing-packages).
3. Confirm that the application can write files to an output folder on your machine.

This article focuses on the fastest path to a first successful export. For package details and version guidance, use the NuGet packages article as the reference source.

## Add the Required Package References

Install the `Telerik.Documents.Flow` package for cross-platform projects or the `Telerik.Windows.Documents.Flow` package for Windows-only projects. After you install the required package, add the namespaces that you need for document creation and editing:

* `Telerik.Documents.Flow.Model`
* `Telerik.Documents.Flow.Model.Editing`

If your export code writes the result to disk, also add the .NET namespaces required by your sample, such as `System.IO`.

## Creating RadFlowDocument from Code

[RadFlowDocument](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/model/radflowdocument) is the main document model in RadWordsProcessing. To add text, paragraphs, and other content in code, use [RadFlowDocumentEditor](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/editing/radflowdocumenteditor), which provides a convenient editing surface over the document.

The following example creates a new document instance and inserts sample content. Use it as the starting point for the rest of this tutorial.

### **Example 1: Create a RadFlowDocument and Insert Sample Text**

```C#
RadFlowDocument document = new RadFlowDocument();
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
editor.InsertText("Hello world!");
```

After you run the code in Example 1, you should have an in-memory `RadFlowDocument` that contains the text you inserted. At this stage, the document exists only in memory, so the next step is to export it to a file format.

## Exporting RadFlowDocument to Docx

Use the [DocxFormatProvider](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/formats-and-conversion/word-file-formats/docx/docxformatprovider) to convert the `RadFlowDocument` to a DOCX file. The provider serializes the in-memory document and lets you save the generated output to a stream or file.

The next example creates a provider instance and exports the document:

### **Example 2: Export a RadFlowDocument to a DOCX File**

```C#
using (Stream output = new FileStream("output.docx", FileMode.OpenOrCreate))
{
    DocxFormatProvider provider = new DocxFormatProvider();
    provider.Export(document, output, TimeSpan.FromSeconds(10));
}
```

When you integrate this example into your project, verify these points:

* The output path exists and your application has permission to write to it.
* The exported file uses the `.docx` extension.
* You reuse the same `RadFlowDocument` instance that you created earlier.

## Verify the Output

Run the application and open the generated DOCX file. If the export succeeds, the file should contain the same content that you inserted with `RadFlowDocumentEditor`.

If the file is not created, check the package references, the output path, and the file-writing code in your sample. If the file opens but does not contain the expected content, confirm that you are exporting the populated `RadFlowDocument` instance instead of a new empty document.

## Next Steps

After you complete this basic flow, continue with the articles that cover the next common tasks:

* Learn more about supported file formats in [Formats and Conversion](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/formats-and-conversion/formats-and-conversion).
* Explore the document object model in [RadWordsProcessing Model Overview](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/model/model).
* Review larger end-to-end samples in [Developer Focused Examples](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/sdk-examples).

## See Also

* [First Steps in Using Telerik Document Processing](https://www.telerik.com/document-processing-libraries/documentation/getting-started/first-steps)
* [RadWordsProcessing Model Overview](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/model/model)
* [Formats and Conversion](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/formats-and-conversion/formats-and-conversion)
* [Developer Focused Examples](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/sdk-examples)
* [WordsProcessing Basic Usage Demo](https://demos.telerik.com/document-processing/wordsprocessing)
