Output format and password

WordProcessingSaveOptions class is responsible for tuning and adjusting the saving process, when EditableDocument instance, that contains already edited document content, should be converted to the output document of some WordProcessing format. In other words, WordProcessingSaveOptions specify how exactly edited HTML should be saved to output document.

Unlike load and edit options, WordProcessingSaveOptions class has one mandatory constructor, that obtains one parameter — outputFormat. The outputFormat parameter has a WordProcessingFormats type. In turn, this type contains all supported formats from WordProcessing format family, which are supportable for saving document. Each field of WordProcessingFormats struct represent one separate WordProcessing format — DOC, DOCX, RTF, ODT etc. There is also an All field, that allows to enumerate over all WordProcessing formats. So, with the outputFormat parameter user should select a specific format of the output WordProcessing document, which should be generated by the Editor.save() method.

This constructor is mandatory, because it is unacceptable to create a WordProcessingSaveOptions instance without output format; otherwise, how GroupDocs.Editor “should know” in which specific format the document should be saved? However, output format can be changed later, after creating an instance of the WordProcessingSaveOptions class, with the OutputFormat property. This property also has a getter, that allows to obtain output format, specified previously in constructor.

Almost all WordProcessing formats, especially with binary nature, support file encoding with the password. If such document is encoded, it is required to specify a password for opening it. WordProcessingSaveOptions class has the next property, which allows to set a password:

public String getPassword()
public void getPassword(String)

By default the value of this property is NULL, which means that password will not be applied. If user specifies a string in this property, the output document will be encoded and protected with this string as a password. If user had specified some password in this property at some step, but then wants to dismiss password and do not encode the document, he can set the value to NULL or empty string, — both these values will be interpreted as “do not set a password” when calling the `Editor.save() method.