This article describes the classes and enums of GroupDocs.Editor, which represent all supportable family formats and individual formats.
GroupDocs.Editor supports different document formats, all of them are conditionally divided into several family formats:
WordProcessing formats, which include DOC, DOCX, DOCM, RTF, ODT etc.
Spreadsheet formats, which include XLS, XLT, XLSX, XLSM, XLTX, ODS etc.
Delimiter-Separated Values (DSV) formats, also known as delimited text, that are a text-based form of spreadsheets, and include CSV, TSV, semicolon-delimited, whitespace-delimited etc.
Presentation formats, which include PPT, PPS, POT, PPTX, PPTM etc.
Text-based formats, which include TXT, HTML, XML etc.
Fixed-layout formats, which include PDF and XPS formats, where their representation is “baked” to be uniform on every platform.
eBook formats, which include Mobi, AZW3 and ePub.
Email formats, which include MSG, EML, PST and others.
For representing these format families, the groupdocs.editor.formats module provides a dedicated enum per family:
TextualFormats, which is common for all text-based formats, including plain text (TXT), markup formats (XML and HTML), and all Delimiter-Separated Values (DSV) formats.
EBookFormats, which is common for all E-book formats, including MOBI, AZW3, and ePub.
FixedLayoutFormats, which is common for only PDF and XPS (this includes OpenXPS).
EmailFormats, which is common for all electronic mail formats.
These enums are case-insensitive and lazy-loaded. Every enum exposes a set of members, each one representing a specific format within the given family format — for example, WordProcessingFormats.DOCX, SpreadsheetFormats.XLSX, or EBookFormats.MOBI. A format member is the value you pass to the matching save options constructor to select the output format.
Fetching a format
You import the family enum from the groupdocs.editor.formats module and access the desired format member by name. The member is then used wherever a target format is required, most notably in the save options constructor:
fromgroupdocs.editor.formatsimportWordProcessingFormatsfromgroupdocs.editor.optionsimportWordProcessingSaveOptions# Fetch one format within the WordProcessing familydocm=WordProcessingFormats.DOCM# Use it to select the output formatsave_options=WordProcessingSaveOptions(docm)
The example below loads a document, reads the format descriptor that GroupDocs.Editor detected, and selects an output format from the WordProcessing family to convert the document.
importosfromgroupdocs.editorimportEditor,Licensefromgroupdocs.editor.formatsimportWordProcessingFormatsfromgroupdocs.editor.optionsimportWordProcessingSaveOptionsdefworking_with_formats():# Optionally set a licenselicense_path=os.path.abspath("./GroupDocs.Editor.lic")ifos.path.exists(license_path):License().set_license(license_path)withEditor("./sample-document.docx")aseditor:# Read the detected format descriptorinfo=editor.get_document_info()print("Detected format:",info.format.name,"(",info.format.extension,")")# Pick a target format from the WordProcessing familytarget_format=WordProcessingFormats.DOCMsave_options=WordProcessingSaveOptions(target_format)# Convert the document to the selected formateditable=editor.edit()editor.save(editable,"./converted-document.docm",save_options)if__name__=="__main__":working_with_formats()
sample-document.docx is the sample file used in this example. Click here to download it.