Before running an example make sure that GroupDocs.Editor for Python via .NET has been installed successfully.
We offer multiple solutions for how you can run GroupDocs.Editor examples, by building your own or by cloning our ready-to-run Python examples repository.
Please choose one from the following list:
Build a project from scratch
Create and activate a virtual environment, then install GroupDocs.Editor for Python via .NET following this guide.
Code your first application with GroupDocs.Editor for Python via .NET like this:
importosfromgroupdocs.editorimportEditor,Licensefromgroupdocs.editor.formatsimportWordProcessingFormatsfromgroupdocs.editor.optionsimportWordProcessingEditOptions,WordProcessingSaveOptionsdefrun_first_example():# Optionally set a licenselicense_path=os.path.abspath("./GroupDocs.Editor.lic")ifos.path.exists(license_path):License().set_license(license_path)# Load the documentwithEditor("./sample-document.docx")aseditor:# Obtain an editable document from the original DOCX documentedit_options=WordProcessingEditOptions()editable_document=editor.edit(edit_options)# Pass the editable document to a WYSIWYG editor and edit there...# ...# Save the edited document back to a WordProcessing format - DOCX, for examplesave_options=WordProcessingSaveOptions(WordProcessingFormats.DOCX)editor.save(editable_document,"./edited-document.docx",save_options)if__name__=="__main__":run_first_example()
sample-document.docx is the sample file used in this example. Click here to download it.
Run your script. The edited document will appear in your working directory.
pyrun_first_example.py
python3 run_first_example.py
python3 run_first_example.py
Run the examples from the repository
The complete examples package of GroupDocs.Editor for Python via .NET is hosted on GitHub. You can either download the ZIP file or clone the repository using your favourite git client.
Or run an individual example by passing its file name:
python <example>.py
The repository contains all the sample documents and resources used in the examples, so the scripts run out of the box.
Contribute
If you would like to add or improve an example, we encourage you to contribute to the project. All examples in this repository are open source and can be freely used in your own applications.
To contribute, you can fork the repository, edit the code, and create a pull request. We will review the changes and include them in the repository if found helpful.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.