OdtSaveOptions

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);

doc = new Document(ArtifactsDir + "OdtSaveOptions.Odt11Schema.odt");
Assert.That(doc.LayoutOptions.RevisionOptions.MeasurementUnit, Is.EqualTo(Aspose.Words.MeasurementUnits.Centimeters));

See Also


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


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)
ParameterTypeDescription
saveFormatSaveFormatCan 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.That(docInfo.IsEncrypted, Is.True);

// 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.That(doc.GetText().Trim(), Is.EqualTo("Hello world!"));

See Also