OdtSaveOptions
Contents
[
Hide
]OdtSaveOptions()
Initializes a new instance of this class that can be used to save a document in the Odt format.
public OdtSaveOptions()
Examples
Shows how to make a saved document conform to an older ODT schema.
Document doc = new Document(MyDir + "Rendering.docx");
OdtSaveOptions saveOptions = new OdtSaveOptions
{
MeasureUnit = OdtSaveMeasureUnit.Centimeters,
IsStrictSchema11 = exportToOdt11Specs
};
doc.Save(ArtifactsDir + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
See Also
- class OdtSaveOptions
- namespace Aspose.Words.Saving
- assembly Aspose.Words
OdtSaveOptions(string)
Initializes a new instance of this class that can be used to save a document in the Odt format encrypted with a password.
public OdtSaveOptions(string password)
See Also
- class OdtSaveOptions
- namespace Aspose.Words.Saving
- assembly Aspose.Words
OdtSaveOptions(SaveFormat)
Initializes a new instance of this class that can be used to save a document in the Odt or Ott format.
public OdtSaveOptions(SaveFormat saveFormat)
Parameter | Type | Description |
---|---|---|
saveFormat | SaveFormat | Can be Odt or Ott. |
Examples
Shows how to encrypt a saved ODT/OTT document with a password, and then load it using Aspose.Words.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello world!");
// Create a new OdtSaveOptions, and pass either "SaveFormat.Odt",
// or "SaveFormat.Ott" as the format to save the document in.
OdtSaveOptions saveOptions = new OdtSaveOptions(saveFormat);
saveOptions.Password = "@sposeEncrypted_1145";
string extensionString = FileFormatUtil.SaveFormatToExtension(saveFormat);
// If we open this document with an appropriate editor,
// it will prompt us for the password we specified in the SaveOptions object.
doc.Save(ArtifactsDir + "OdtSaveOptions.Encrypt" + extensionString, saveOptions);
FileFormatInfo docInfo = FileFormatUtil.DetectFileFormat(ArtifactsDir + "OdtSaveOptions.Encrypt" + extensionString);
Assert.IsTrue(docInfo.IsEncrypted);
// If we wish to open or edit this document again using Aspose.Words,
// we will have to provide a LoadOptions object with the correct password to the loading constructor.
doc = new Document(ArtifactsDir + "OdtSaveOptions.Encrypt" + extensionString,
new LoadOptions("@sposeEncrypted_1145"));
Assert.AreEqual("Hello world!", doc.GetText().Trim());
See Also
- enum SaveFormat
- class OdtSaveOptions
- namespace Aspose.Words.Saving
- assembly Aspose.Words