Skip to content

Commit 35c2c2a

Browse files
Add code example that demonstrates how to specify output format
1 parent b8e97f9 commit 35c2c2a

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from groupdocs.conversion import Converter
2+
from groupdocs.conversion.options.convert import WordProcessingConvertOptions
3+
from groupdocs.conversion.filetypes import WordProcessingFileType
4+
5+
def specify_output_format():
6+
# Instantiate Converter with the input document
7+
with Converter("./business-plan.docx") as converter:
8+
# Instantiate convert options to define the output format
9+
word_convert_options = WordProcessingConvertOptions()
10+
# Set the output fomormat to TXT
11+
word_convert_options.format = WordProcessingFileType.TXT
12+
13+
# Convert the input document to TXT
14+
converter.convert("./business-plan.txt", word_convert_options)
15+
16+
if __name__ == "__main__":
17+
specify_output_format()

‎Examples/run_all_examples.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55
# Set license path
6-
# os.environ["GROUPDOCS_LIC_PATH"] = "/path/to/your/license/file.lic"
6+
os.environ["GROUPDOCS_LIC_PATH"] = "C://Licenses//GroupDocs.Total.lic"
77

88
# Console output colors
99
YELLOW = "\033[93m"
@@ -65,8 +65,9 @@ def print_intro():
6565
"developer-guide/converting-documents/get-possible-conversions/get_all_possible_conversions_for_current_file.py",
6666

6767
# Convert a Document to Another Format
68-
"developer-guide/converting-documents/convert-document-to-another-format/convert_consecutive_document_pages.py",
6968
"developer-guide/converting-documents/convert-document-to-another-format/convert_document_to_another_format.py",
69+
"developer-guide/converting-documents/convert-document-to-another-format/specify_output_format.py",
70+
"developer-guide/converting-documents/convert-document-to-another-format/convert_consecutive_document_pages.py",
7071
"developer-guide/converting-documents/convert-document-to-another-format/convert_specific_document_pages.py",
7172

7273
# Convert a Document to Multiple Page Files

0 commit comments

Comments
 (0)