# Using DocFormatProvider

DOC is the default target binary file format developed by Microsoft for representing documents in Word 97–2003. DOT is the binary file format developed by Microsoft for representing templates in Word 97–2003.

`DocFormatProvider` allows you to import a DOC or DOT file into a `RadFlowDocument`. The provider preserves the entire document structure and formatting.

To use `DocFormatProvider`, add references to the following packages:

* Telerik.Windows.Documents.Core
* Telerik.Windows.Documents.Flow
* Telerik.Windows.Documents.Flow\.FormatProviders.Doc
* Telerik.Windows.Zip

## Import

To import a DOC or DOT file, use the `Import()` method of `DocFormatProvider`.

**Example 1: Open a Sample.doc file stream and import it into a RadFlowDocument**

```C#
Telerik.Documents.Flow.Model.RadFlowDocument document;

Telerik.Documents.Flow.FormatProviders.Doc.DocFormatProvider provider = new Telerik.Documents.Flow.FormatProviders.Doc.DocFormatProvider();

using (Stream input = File.OpenRead("Sample.doc"))
{
    document = provider.Import(input, TimeSpan.FromSeconds(10));
}
```

You can also import a document from a byte array containing the document:

**Example 2: Read a Sample.doc file into a byte array and import it into a RadFlowDocument**

```C#
byte[] input = File.ReadAllBytes("Sample.doc");
Telerik.Documents.Flow.FormatProviders.Doc.DocFormatProvider provider = new Telerik.Documents.Flow.FormatProviders.Doc.DocFormatProvider();

Telerik.Documents.Flow.Model.RadFlowDocument document = provider.Import(input, TimeSpan.FromSeconds(10));
```

The resulting `RadFlowDocument` can be manipulated like any code-generated document.

## See Also

* [Timeout Mechanism](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/timeout-mechanism-in-dpl)
* [Automatic Output Stream Clearing on Export](https://www.telerik.com/document-processing-libraries/documentation/common-information/clear-output-stream-on-export)
