Aspose::Words::Saving::OdtSaveOptions::OdtSaveOptions constructor
Contents
[
Hide
]OdtSaveOptions::OdtSaveOptions() constructor
Initializes a new instance of this class that can be used to save a document in the Odt format.
Aspose::Words::Saving::OdtSaveOptions::OdtSaveOptions()
Examples
Shows how to make a saved document conform to an older ODT schema.
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto saveOptions = MakeObject<OdtSaveOptions>();
saveOptions->set_MeasureUnit(OdtSaveMeasureUnit::Centimeters);
saveOptions->set_IsStrictSchema11(exportToOdt11Specs);
doc->Save(ArtifactsDir + u"OdtSaveOptions.Odt11Schema.odt", saveOptions);
See Also
- Class OdtSaveOptions
- Namespace Aspose::Words::Saving
- Library Aspose.Words for C++
OdtSaveOptions::OdtSaveOptions(Aspose::Words::SaveFormat) constructor
Initializes a new instance of this class that can be used to save a document in the Odt or Ott format.
Aspose::Words::Saving::OdtSaveOptions::OdtSaveOptions(Aspose::Words::SaveFormat saveFormat)
Parameter | Type | Description |
---|---|---|
saveFormat | Aspose::Words::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.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Hello world!");
// Create a new OdtSaveOptions, and pass either "SaveFormat.Odt",
// or "SaveFormat.Ott" as the format to save the document in.
auto saveOptions = MakeObject<OdtSaveOptions>(saveFormat);
saveOptions->set_Password(u"@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 + u"OdtSaveOptions.Encrypt" + extensionString, saveOptions);
SharedPtr<FileFormatInfo> docInfo = FileFormatUtil::DetectFileFormat(ArtifactsDir + u"OdtSaveOptions.Encrypt" + extensionString);
ASSERT_TRUE(docInfo->get_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 = MakeObject<Document>(ArtifactsDir + u"OdtSaveOptions.Encrypt" + extensionString, MakeObject<LoadOptions>(u"@sposeEncrypted_1145"));
ASSERT_EQ(u"Hello world!", doc->GetText().Trim());
See Also
- Enum SaveFormat
- Class OdtSaveOptions
- Namespace Aspose::Words::Saving
- Library Aspose.Words for C++
OdtSaveOptions::OdtSaveOptions(const System::String&) constructor
Initializes a new instance of this class that can be used to save a document in the Odt format encrypted with a password.
Aspose::Words::Saving::OdtSaveOptions::OdtSaveOptions(const System::String &password)
See Also
- Class OdtSaveOptions
- Namespace Aspose::Words::Saving
- Library Aspose.Words for C++