WordProcessingFileType class

WordProcessingFileType class

The WordProcessingFileType class defines Word Processing file formats, covering plain text and rich text variants.

Plain text files contain unformatted text with no font or page settings applied. Rich text files support formatting options such as font types, styles (bold, italic, underline), page margins, headings, bullets, numbers, and other features.

Learn more about Word Processing formats here: https://wiki.fileformat.com/word-processing

The WordProcessingFileType type exposes the following members:

Constructors

Constructor Description
init Initializes a WordProcessingFileType for serialization.

Methods

Method Description
compare_to Compares current object to other. (inherited from Enumeration)
compare_to_object (inherited from Enumeration)
equals Implements the equality comparison defined by Enumeration.equals. (inherited from FileType)
equals_enumeration (inherited from FileType)
equals_object (inherited from Enumeration)
from_display_name (inherited from Enumeration)
from_extension Gets the FileType for the provided file extension. (inherited from FileType)
from_filename Returns FileType for specified file_name. (inherited from FileType)
from_stream Returns FileType for provided document stream. (inherited from FileType)
from_value (inherited from Enumeration)
get_all (inherited from FileType)
get_hash_code Provides the default hash function. (inherited from Enumeration)
to_string String representation of file type. (inherited from FileType)

Properties

Property Description
description The file type description. (inherited from FileType)
extension The file extension. (inherited from FileType)
family The file family. (inherited from FileType)
file_format The file format. (inherited from FileType)

Fields

Field Description
DOC Files with .doc extension represent documents generated by Microsoft Word or other word processing documents in binary file format. Learn more about this file format here.
DOCM DOCM files are Microsoft Word 2007 or higher generated documents with the ability to run macros. Learn more about this file format here.
DOCX DOCX is a well-known format for Microsoft Word documents. Introduced from 2007 with the release of Microsoft Office 2007, the structure of this new Document format was changed from plain binary to a combination of XML and binary files. Learn more about this file format here.
DOT Files with .DOT extension are template files created by Microsoft Word to have pre-formatted settings for generation of further DOC or DOCX files. Learn more about this file format here.
DOTM A file with DOTM extension represents template file created with Microsoft Word 2007 or higher. Learn more about this file format here.
DOTX Files with DOTX extension are template files created by Microsoft Word to have pre-formatted settings for generation of further DOCX files. Learn more about this file format here.
RTF Introduced and documented by Microsoft, the Rich Text Format (RTF) represents a method of encoding formatted text and graphics for use within applications. Learn more about this file format here.
ODT ODT files are type of documents created with word processing applications that are based on OpenDocument Text File format. Learn more about this file format here.
OTT Files with OTT extension represent template documents generated by applications in compliance with the OASIS’ OpenDocument standard format. Learn more about this file format here.
TXT A file with .TXT extension represents a text document that contains plain text in the form of lines. Learn more about this file format here.
MD Text files created with Markdown language dialects is saved with .MD or .MARKDOWN file extension. MD files are saved in plain text format that uses Markdown language which also includes inline text symbols, defining how a text can be formatted such as indentations, table formatting, fonts, and headers. Learn more about this file format here.
FLAT_OPC Flat OPC Word is Office Open XML WordprocessingML stored in a flat XML file instead of a ZIP package.
UNKNOWN Unknown file type (inherited from FileType)

Example

from groupdocs.conversion import Converter
from groupdocs.conversion.options.convert import WordProcessingConvertOptions
from groupdocs.conversion.filetypes import WordProcessingFileType

def specify_output_format():
    # Instantiate Converter with the input document
    with Converter("./business-plan.docx") as converter:
        # Define convert options; default output format is DOCX
        word_convert_options = WordProcessingConvertOptions()
        # Change the output format within the format family from DOCX to TXT
        word_convert_options.format = WordProcessingFileType.Txt

        # Convert the input document to TXT
        converter.convert("./business-plan.txt", word_convert_options)

if __name__ == "__main__":
    specify_output_format()

Guides

Task guides that use WordProcessingFileType:

See Also