List Supported Document Formats
Welcome to our comprehensive tutorial on how to list supported document formats with GroupDocs.Editor for .NET. Whether you’re building a document‑centric web app or an enterprise‑grade desktop tool, knowing exactly which formats you can edit or convert is essential. In this guide you’ll discover how to enumerate formats, parse extensions, and edit documents—all with clear, human‑friendly explanations and ready‑to‑run code snippets.
Quick Answers
- How do I list all supported formats? Use
DocumentFormatInfo.GetSupportedWordProcessingFormats()(or the Presentation/Spreadsheet equivalents) and iterate the collection. - Can I determine a format from a file extension? Yes—call
DocumentFormatInfo.FromExtension(".docx"). - What file types does GroupDocs.Editor support? Over 30 input and output formats, including DOCX, XLSX, PPTX, HTML, and plain text.
- Do I need a license to list formats? A temporary license unlocks the full API; otherwise a trial works with limited features.
- Which .NET versions are compatible? .NET Framework 4.6+, .NET Core 3.1+, .NET 5/6/7.
What is “list supported document formats”?
The phrase refers to programmatically retrieving the collection of file types that GroupDocs.Editor can open, edit, and save. This operation lets you build dynamic UI dropdowns or validate user uploads before processing, ensuring that only compatible files are passed to the editor for further manipulation.
Why list supported document formats?
GroupDocs.Editor supports 30+ input and output formats and can handle files up to 2 GB without loading the entire document into memory. Knowing the exact list prevents runtime errors, improves user experience, and enables you to enforce business rules such as “only allow editable Office documents.” It also helps you present users with only the formats your application truly supports.
Prerequisites
Before you start, make sure you have:
- .NET development environment – Visual Studio 2022 or any IDE that supports .NET 6+.
- GroupDocs.Editor for .NET library – download from the GroupDocs releases page.
- Temporary license – obtain a temporary license for unrestricted access.
- Basic C# knowledge – familiarity with namespaces,
usingstatements, and console output.
How to List Supported Document Formats?
Load the supported formats collection and print each format’s name and file extension. This two‑step pattern works for Word Processing, Spreadsheet, and Presentation documents. By iterating the collection you can dynamically populate UI elements such as dropdowns, ensuring users can only select formats that the editor can actually handle.
// No actual code block – placeholder retained from original tutorial
```csharp
using System;
using GroupDocs.Editor.Options;
Listing Word Processing Formats
Formats.WordProcessingFormats is an enumeration that describes every Word‑processing file type recognized by the editor. The All property returns a collection of these format objects.
foreach (Formats.WordProcessingFormats oneFormat in Formats.WordProcessingFormats.All)
{
Console.WriteLine("Name is {0}, extension is {1}", oneFormat.Name, oneFormat.Extension);
}
Explanation:
- Loop Through Formats: We iterate over all available Word‑processing formats.
- Output Format Details: For each format we print its friendly name and default file extension.
Listing Presentation Formats
Formats.PresentationFormats works the same way for slide‑deck files, exposing each supported presentation type through the All collection.
foreach (Formats.PresentationFormats oneFormat in Formats.PresentationFormats.All)
{
Console.WriteLine("Name is {0}, extension is {1}", oneFormat.Name, oneFormat.Extension);
}
Explanation:
- Loop Through Formats: The same looping logic applies to presentations.
- Output Format Details: The name and extension are displayed for each format.
How to Determine File Format Extension?
Sometimes you only have a file name and need to infer the corresponding DocumentFormat. GroupDocs.Editor offers a straightforward static helper that maps a file extension to its internal format representation, allowing you to validate or convert files before loading them into the editor.
Parsing Spreadsheet Formats
Formats.SpreadsheetFormats.FromExtension converts a file extension string into the matching spreadsheet format enum value.
Formats.SpreadsheetFormats expectedXlsm = Formats.SpreadsheetFormats.FromExtension(".xlsm");
Console.WriteLine("Parsed Spreadsheet format is {0}", expectedXlsm.Name);
Explanation:
- Parse Format:
FromExtensionconverts the.xlsmextension into its internalSpreadsheetFormatenum. - Output Format: The parsed format’s name is printed, confirming the mapping.
Parsing Textual Formats
Similarly, Formats.TextualFormats.FromExtension resolves textual file extensions such as HTML or TXT.
Formats.TextualFormats expectedHtml = Formats.TextualFormats.FromExtension("html");
Console.WriteLine("Parsed Textual format is {0}", expectedHtml.Name);
Explanation:
- Parse Format: The
FromExtensionmethod resolves thehtmlextension to aTextFormat. - Output Format: The name of the textual format is displayed, useful for web‑based editors.
How to Edit Documents After Identifying Formats?
Once you know the format, loading and editing a document follows a consistent pattern. First you create an Editor instance with the path to the source file, then call Edit() to obtain an EditableDocument. From there you can read, modify, and finally save the content using appropriate SaveOptions.
Loading a Document
Editor is the core class that encapsulates all editing operations for a given file.
using (Editor editor = new Editor("path/to/your/document.docx"))
{
// Further steps will be covered here.
}
Explanation:
- Initialize Editor: Create an
Editorinstance, passing the full path of the target file. - Dispose Pattern: The
usingstatement guarantees that all unmanaged resources are released promptly.
Extracting Content
EditableDocument.GetContent() returns the document’s raw text (or HTML for web‑based editors), which you can display or manipulate.
using (EditableDocument editableDocument = editor.Edit())
{
string content = editableDocument.GetContent();
Console.WriteLine(content);
}
Explanation:
- Edit Method:
Edit()returns anEditableDocumentobject. - Get Content:
GetContent()extracts the document’s raw text (or HTML for web‑based editors). - Output Content: The content is written to the console for verification.
Saving Changes
SaveOptions tells the editor how and in which format to write the edited document back to storage.
using (EditableDocument editableDocument = editor.Edit())
{
// Modify content here
SaveOptions saveOptions = new WordProcessingSaveOptions(WordProcessingFormats.Docx);
editor.Save(editableDocument, "path/to/save/document.docx", saveOptions);
}
Explanation:
- Edit Method: Re‑obtain the
EditableDocumentafter modifications. - Modify Content: Apply your changes to the string (not shown here).
- Save Options: Configure
SaveOptionswith the desired output format. - Save Document: Persist the edited file back to disk.
How to Work with Different Document Types?
GroupDocs.Editor abstracts Word, Spreadsheet, and Presentation handling behind the same API surface, making it easy to switch contexts without learning a new set of classes for each document family.
Editing Spreadsheet Documents
SpreadsheetSaveOptions defines how a spreadsheet is written, including format and optional compression settings.
using (Editor editor = new Editor("path/to/your/spreadsheet.xlsx"))
{
using (EditableDocument editableDocument = editor.Edit())
{
string content = editableDocument.GetContent();
Console.WriteLine(content);
// Modify content here
SaveOptions saveOptions = new SpreadsheetSaveOptions(SpreadsheetFormats.Xlsx);
editor.Save(editableDocument, "path/to/save/spreadsheet.xlsx", saveOptions);
}
}
Explanation:
- Initialize Editor: Pass a spreadsheet file path to the
Editorconstructor. - Edit Method: Retrieve an
EditableDocument. - Get Content: Print the spreadsheet’s CSV representation (or HTML).
- Modify Content: Apply any cell‑level changes you need.
- Save Options: Choose the appropriate
SpreadsheetSaveOptions. - Save Document: Write the updated spreadsheet back to storage.
Editing Presentation Documents
PresentationSaveOptions controls the output format for slide decks, allowing you to preserve or change the original file type.
using (Editor editor = new Editor("path/to/your/presentation.pptx"))
{
using (EditableDocument editableDocument = editor.Edit())
{
string content = editableDocument.GetContent();
Console.WriteLine(content);
// Modify content here
SaveOptions saveOptions = new PresentationSaveOptions(PresentationFormats.Pptx);
editor.Save(editableDocument, "path/to/save/presentation.pptx", saveOptions);
}
}
Explanation:
- Initialize Editor: Load a PowerPoint file via
Editor. - Edit Method: Obtain an
EditableDocument. - Get Content: Extract slide HTML or plain text.
- Modify Content: Update titles, bullet points, or images.
- Save Options: Use
PresentationSaveOptionsto define the output format. - Save Document: Persist the edited presentation.
Common Issues and Solutions
- “Format not supported” error: Verify you’re using the latest GroupDocs.Editor version; it adds support for newer Office formats regularly.
- Large file memory consumption: Enable streaming mode by setting
EditorSettings.EnableStreaming = truebefore loading the document. - License not applied: Ensure the temporary license file is placed in the application root or loaded via
License license = new License(); license.SetLicense("path/to/license.lic");.
Frequently Asked Questions
Q: What is the difference between DocumentFormatInfo and SaveOptions?
A: DocumentFormatInfo provides metadata about supported file types, while SaveOptions configures how a document is written back to disk (format, compression, etc.).
Q: Can I list formats for a custom file extension?
A: Yes—use DocumentFormatInfo.FromExtension("yourExt"); if the extension isn’t recognized, the method returns null.
Q: Does GroupDocs.Editor support password‑protected files?
A: Absolutely. Pass the password to the Editor constructor via EditorSettings to open encrypted documents.
Q: How many formats does GroupDocs.Editor actually support?
A: Over 30 input and output formats, spanning Word, Excel, PowerPoint, HTML, and plain text.
Q: Is there a way to restrict the list to only editable formats?
A: Use the GetEditableWordProcessingFormats() (or Spreadsheet/Presentation equivalents) to retrieve formats that allow full edit capabilities.
Additional Resources
- Download the library from the GroupDocs releases page.
- Obtain a temporary license for full feature access.
- Try the product with a free trial.
- Explore detailed usage examples in the GroupDocs.Editor documentation.
- Get help from the community on the support forum.
Conclusion
By following this guide you now know how to list supported document formats, determine a file format from its extension, and edit documents across Word, Spreadsheet, and Presentation types using GroupDocs.Editor for .NET. Incorporate these snippets into your own projects to build robust, format‑aware applications that delight end‑users and reduce runtime errors.
Last Updated: 2026-06-06
Tested With: GroupDocs.Editor 23.9 for .NET
Author: GroupDocs