This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/conversion/rtf-to-docx.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. RTF to DOCX C#: Convert RTF to Word in .NET | Nutrient .NET SDK
RTF to DOCX

Nutrient .NET SDK (formerly GdPicture.NET) includes the ability to convert any supported file type into Word.

To save an RTF document to a Word document (DOCX), first use the LoadFromFile method of the GdPictureDocumentConverter class to load it. Then use the SaveAsDOCX method to convert it to a DOCX.

The LoadFromFile method uses the following parameter:

  • FilePath — The source RTF file path.
  • DocumentFormat — A member of the DocumentFormat enumeration. Use DocumentFormat.DocumentFormatRTF for RTF input.

The SaveAsDOCX method uses the following parameter:

  • Stream, or the overload FilePath — A stream or file path where the currently loaded document is saved as a DOCX file. When using a stream, it must be open for reading, writing, and seeking.

When you use the stream overload, the stream should be open for both reading and writing, and it should be closed/disposed of by the user once processing is complete using the CloseDocument method.

How to convert RTF to DOCX

  1. Create a GdPictureDocumentConverter object.
  2. Load the source RTF file with GdPictureDocumentConverter.LoadFromFile(String, DocumentFormat) using DocumentFormat.DocumentFormatRTF.
  3. Save the loaded document as a DOCX using SaveAsDOCX.

The following example converts and saves an RTF document to a DOCX file:

using GdPictureDocumentConverter converter = new();
GdPictureStatus status = converter.LoadFromFile(@"input.rtf", GdPicture14.DocumentFormat.DocumentFormatRTF);
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}
status = converter.SaveAsDOCX("output.docx");
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}
status = converter.CloseDocument();
if (status != GdPictureStatus.OK && status != GdPictureStatus.Aborted)
{
throw new Exception(status.ToString());
}
Console.WriteLine("The input document has been converted to a docx file");

Optional DOCX configuration properties

Optionally, configure the conversion with the following properties of the GdPictureDocumentConverter object:

  • DocxImageQuality is an integer from 0 to 100 that specifies the quality used to compress images embedded in the resulting DOCX document.
  • RasterizationDPI is an integer that specifies the resolution, expressed in dots per inch (DPI), used when vector content must be rasterized during conversion to DOCX.