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

Nutrient .NET SDK (formerly GdPicture.NET) supports converting 100+ file types to Word, Excel, or PowerPoint. For more information, refer to the full list of supported file types.

Office target availability depends on the source file type, and not every input can be meaningfully converted to every Office format.

Converting PDF to MS Office

To convert PDF files to MS Office, refer to our separate PDF-to-Word, PDF-to-Excel, and PDF-to-PowerPoint guides.

Converting other file types to MS Office

To save a file to Word, Excel, or PowerPoint format, first load the source document with the [LoadFromFile method][loadfromfile] of the GdPictureDocumentConverter class. Then use the [SaveAsDOCX method][saveasdocx] to convert it to a DOCX, the [SaveAsXLSX method][saveasxlsx] to convert it to an XLSX, or the [SaveAsPPTX method][saveaspptx] to convert it to a PPTX.

The LoadFromFile method uses the following parameters:

  • FilePath — The source file path.
  • DocumentFormat — A member of the [DocumentFormat enumeration][documentformat]. Specify the source file format when possible. Use DocumentFormat.DocumentFormatUNKNOWN if you aren’t sure about the format.

The SaveAsDOCX, SaveAsXLSX, and SaveAsPPTX methods use the following parameter:

  • Stream, or the overload FilePath — A stream or file path where the currently loaded document is saved. 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][closedocument method].

How to convert any file to MS Office

  1. Create a GdPictureDocumentConverter object.
  2. Load the source file with [GdPictureDocumentConverter.LoadFromFile(String, DocumentFormat)][loadfromfile]. Recommended: Specify the source document format with a member of the [DocumentFormat enumeration][documentformat].
  3. Save the loaded document as a DOCX using SaveAsDOCX, as an XLSX using SaveAsXLSX, or as a PPTX using SaveAsPPTX.

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");
See also
Related topics

Optional file type configuration properties

The following file types have optional configuration properties for greater precision:

Optional Office conversion 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 Office formats.