# Output format and password Following this guide you will learn how to save edited Word document with password or change output document format using GroupDocs.Editor for Python via .NET features. The [`WordProcessingSaveOptions`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.options/wordprocessingsaveoptions) class is responsible for tuning and adjusting the saving process, when an [`EditableDocument`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor/editabledocument) instance, that contains already edited document content, should be converted to the output document of some WordProcessing format. In other words, the [`WordProcessingSaveOptions`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.options/wordprocessingsaveoptions) class specifies how exactly the edited HTML should be saved to the output document. Unlike load and edit options, the [`WordProcessingSaveOptions`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.options/wordprocessingsaveoptions) class has one mandatory constructor parameter — `output_format`. The `output_format` parameter has a [`WordProcessingFormats`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.formats/wordprocessingformats) type. In turn, this type contains all supported formats from the [family of WordProcessing formats](https://docs.fileformat.com/word-processing/), which are supported for saving documents. Each field of [`WordProcessingFormats`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.formats/wordprocessingformats) represents one separate WordProcessing format — DOC, DOCX, RTF, ODT etc. So, with the `output_format` parameter the user should select a specific format of the output WordProcessing document, which should be generated by the [`editor.save()`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor/editor/save) method. ```python from groupdocs.editor.formats import WordProcessingFormats from groupdocs.editor.options import WordProcessingSaveOptions save_options = WordProcessingSaveOptions(WordProcessingFormats.RTF) ``` This constructor parameter is mandatory, because it is unacceptable to create a [`WordProcessingSaveOptions`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.options/wordprocessingsaveoptions) instance without an output format; otherwise, how would GroupDocs.Editor "know" into which specific format the document should be saved? However, the output format can be changed later, after creating an instance of the [`WordProcessingSaveOptions`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.options/wordprocessingsaveoptions) class, with the `output_format` property. This property also has a getter, that allows to obtain the output format, specified previously in the constructor. ```python save_options.output_format = WordProcessingFormats.DOCX ``` Almost all WordProcessing formats, especially those with a binary nature, support file encoding with a password. If such a document is encoded, it is required to specify a password for opening it. The [`WordProcessingSaveOptions`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor.options/wordprocessingsaveoptions) class has the following property, which allows to set a password: ```python save_options.password = "p@ss" ``` By default the value of this property is `None`, which means that a password will not be applied. If the user specifies a string in this property, the output document will be encoded and protected with this string as a password. If the user has specified some password in this property at some step, but then wants to dismiss the password and not encode the document, he can set the value to `None` or an empty string — both these values will be interpreted as "do not set a password" when calling the [`editor.save()`](https://reference.groupdocs.com/editor/python-net/groupdocs.editor/editor/save) method. ## Complete example The example below loads the sample document, edits it, and saves the result to the RTF format encrypted with a password. {{< tabs "code-example-output-format-and-password">}} {{< tab "set_output_format_and_password.py" >}} ```python import os from groupdocs.editor import Editor, EditableDocument, License from groupdocs.editor.formats import WordProcessingFormats from groupdocs.editor.options import WordProcessingSaveOptions def set_output_format_and_password(): # Optionally set a license license_path = os.path.abspath("./GroupDocs.Editor.lic") if os.path.exists(license_path): License().set_license(license_path) with Editor("./sample-document.docx") as editor: original = editor.edit() modified = EditableDocument.from_markup(original.get_embedded_html()) # Select the output format and protect the document with a password save_options = WordProcessingSaveOptions(WordProcessingFormats.RTF) save_options.password = "p@ss" editor.save(modified, "./protected-output.rtf", save_options) print("Saved a password-protected RTF document") original.dispose() modified.dispose() if __name__ == "__main__": set_output_format_and_password() ``` {{< /tab >}} {{< tab "sample-document.docx" >}} {{< tab-text >}} `sample-document.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/editor/python-net/_sample_files/developer-guide/edit-document/edit-word/output-format-and-password/sample-document.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "protected-output.rtf" >}} ```text Binary file (RTF, 1.6 MB) ``` [Download full output](https://docs.groupdocs.com/editor/python-net/_output_files/developer-guide/edit-document/edit-word/output-format-and-password/set_output_format_and_password/protected-output.rtf) {{< /tab >}} {{< /tabs >}}