public class OdtSaveOptions extends SaveOptions
SaveFormat.ODT or SaveFormat.OTT format.
To learn more, visit the Specify Save Options documentation article.
Remarks:
At the moment provides only the getSaveFormat() / setSaveFormat(int) property, but in the future will have other options added, such as an encryption password or digital signature settings.
Examples:
Shows how to make a saved document conform to an older ODT schema.
Document doc = new Document(getMyDir() + "Rendering.docx");
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(OdtSaveMeasureUnit.CENTIMETERS);
saveOptions.isStrictSchema11(exportToOdt11Specs);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
Shows how to use different measurement units to define style parameters of a saved ODT document.
Document doc = new Document(getMyDir() + "Rendering.docx");
// When we export the document to .odt, we can use an OdtSaveOptions object to modify how we save the document.
// We can set the "MeasureUnit" property to "OdtSaveMeasureUnit.Centimeters"
// to define content such as style parameters using the metric system, which Open Office uses.
// We can set the "MeasureUnit" property to "OdtSaveMeasureUnit.Inches"
// to define content such as style parameters using the imperial system, which Microsoft Word uses.
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(odtSaveMeasureUnit);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
| Constructor and Description |
|---|
OdtSaveOptions()
Initializes a new instance of this class that can be used to save a document in the
SaveFormat.ODT format. |
OdtSaveOptions(int saveFormat)
Initializes a new instance of this class.
|
OdtSaveOptions(java.lang.String password)
Initializes a new instance of this class that can be used to save a document in the
SaveFormat.ODT format encrypted with a password. |
| Modifier and Type | Method and Description |
|---|---|
DigitalSignatureDetails |
getDigitalSignatureDetails()
Gets
DigitalSignatureDetails object used to sign a document. |
int |
getMeasureUnit()
Allows to specify units of measure to apply to document content.
|
java.lang.String |
getPassword()
Gets a password to encrypt document.
|
int |
getSaveFormat()
Specifies the format in which the document will be saved if this save options object is used.
|
boolean |
isStrictSchema11()
Specifies whether export should correspond to ODT specification 1.1 strictly.
|
void |
isStrictSchema11(boolean value)
Specifies whether export should correspond to ODT specification 1.1 strictly.
|
void |
setDigitalSignatureDetails(DigitalSignatureDetails value)
Sets
DigitalSignatureDetails object used to sign a document. |
void |
setMeasureUnit(int value)
Allows to specify units of measure to apply to document content.
|
void |
setPassword(java.lang.String value)
Sets a password to encrypt document.
|
void |
setSaveFormat(int value)
Specifies the format in which the document will be saved if this save options object is used.
|
createSaveOptions, createSaveOptions, getAllowEmbeddingPostScriptFonts, getCustomTimeZoneInfo, getDefaultTemplate, getDml3DEffectsRenderingMode, getDmlEffectsRenderingMode, getDmlRenderingMode, getExportGeneratorName, getImlRenderingMode, getMemoryOptimization, getPrettyFormat, getProgressCallback, getTempFolder, getUpdateAmbiguousTextFont, getUpdateCreatedTimeProperty, getUpdateFields, getUpdateLastPrintedProperty, getUpdateLastSavedTimeProperty, getUseAntiAliasing, getUseHighQualityRendering, setAllowEmbeddingPostScriptFonts, setCustomTimeZoneInfo, setDefaultTemplate, setDml3DEffectsRenderingMode, setDmlEffectsRenderingMode, setDmlRenderingMode, setExportGeneratorName, setImlRenderingMode, setMemoryOptimization, setPrettyFormat, setProgressCallback, setTempFolder, setUpdateAmbiguousTextFont, setUpdateCreatedTimeProperty, setUpdateFields, setUpdateLastPrintedProperty, setUpdateLastSavedTimeProperty, setUseAntiAliasing, setUseHighQualityRenderingpublic OdtSaveOptions()
SaveFormat.ODT format.
Examples:
Shows how to make a saved document conform to an older ODT schema.
Document doc = new Document(getMyDir() + "Rendering.docx");
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(OdtSaveMeasureUnit.CENTIMETERS);
saveOptions.isStrictSchema11(exportToOdt11Specs);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
public OdtSaveOptions(java.lang.String password)
SaveFormat.ODT format encrypted with a password.public OdtSaveOptions(int saveFormat)
public int getSaveFormat()
SaveFormat.ODT or SaveFormat.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.setPassword("@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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString, saveOptions);
FileFormatInfo docInfo = FileFormatUtil.detectFileFormat(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString);
Assert.assertTrue(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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString,
new LoadOptions("@sposeEncrypted_1145"));
Assert.assertEquals("Hello world!", doc.getText().trim());
getSaveFormat in class SaveOptionsint value. The returned value is one of SaveFormat constants.public void setSaveFormat(int value)
SaveFormat.ODT or SaveFormat.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.setPassword("@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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString, saveOptions);
FileFormatInfo docInfo = FileFormatUtil.detectFileFormat(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString);
Assert.assertTrue(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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString,
new LoadOptions("@sposeEncrypted_1145"));
Assert.assertEquals("Hello world!", doc.getText().trim());
setSaveFormat in class SaveOptionsvalue - The corresponding int value. The value must be one of SaveFormat constants.public boolean isStrictSchema11()
false.
Examples:
Shows how to make a saved document conform to an older ODT schema.
Document doc = new Document(getMyDir() + "Rendering.docx");
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(OdtSaveMeasureUnit.CENTIMETERS);
saveOptions.isStrictSchema11(exportToOdt11Specs);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
boolean value.public void isStrictSchema11(boolean value)
false.
Examples:
Shows how to make a saved document conform to an older ODT schema.
Document doc = new Document(getMyDir() + "Rendering.docx");
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(OdtSaveMeasureUnit.CENTIMETERS);
saveOptions.isStrictSchema11(exportToOdt11Specs);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
value - The corresponding boolean value.public int getMeasureUnit()
OdtSaveMeasureUnit.CENTIMETERS
Remarks:
Open Office uses centimeters when specifying lengths, widths and other measurable formatting and content properties in documents whereas MS Office uses inches.
Examples:
Shows how to make a saved document conform to an older ODT schema.
Document doc = new Document(getMyDir() + "Rendering.docx");
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(OdtSaveMeasureUnit.CENTIMETERS);
saveOptions.isStrictSchema11(exportToOdt11Specs);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
Shows how to use different measurement units to define style parameters of a saved ODT document.
Document doc = new Document(getMyDir() + "Rendering.docx");
// When we export the document to .odt, we can use an OdtSaveOptions object to modify how we save the document.
// We can set the "MeasureUnit" property to "OdtSaveMeasureUnit.Centimeters"
// to define content such as style parameters using the metric system, which Open Office uses.
// We can set the "MeasureUnit" property to "OdtSaveMeasureUnit.Inches"
// to define content such as style parameters using the imperial system, which Microsoft Word uses.
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(odtSaveMeasureUnit);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
int value. The returned value is one of OdtSaveMeasureUnit constants.public void setMeasureUnit(int value)
OdtSaveMeasureUnit.CENTIMETERS
Remarks:
Open Office uses centimeters when specifying lengths, widths and other measurable formatting and content properties in documents whereas MS Office uses inches.
Examples:
Shows how to make a saved document conform to an older ODT schema.
Document doc = new Document(getMyDir() + "Rendering.docx");
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(OdtSaveMeasureUnit.CENTIMETERS);
saveOptions.isStrictSchema11(exportToOdt11Specs);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
Shows how to use different measurement units to define style parameters of a saved ODT document.
Document doc = new Document(getMyDir() + "Rendering.docx");
// When we export the document to .odt, we can use an OdtSaveOptions object to modify how we save the document.
// We can set the "MeasureUnit" property to "OdtSaveMeasureUnit.Centimeters"
// to define content such as style parameters using the metric system, which Open Office uses.
// We can set the "MeasureUnit" property to "OdtSaveMeasureUnit.Inches"
// to define content such as style parameters using the imperial system, which Microsoft Word uses.
OdtSaveOptions saveOptions = new OdtSaveOptions();
{
saveOptions.setMeasureUnit(odtSaveMeasureUnit);
}
doc.save(getArtifactsDir() + "OdtSaveOptions.Odt11Schema.odt", saveOptions);
value - The corresponding int value. The value must be one of OdtSaveMeasureUnit constants.public java.lang.String getPassword()
Remarks:
In order to save document without encryption this property should be null or empty string.
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.setPassword("@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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString, saveOptions);
FileFormatInfo docInfo = FileFormatUtil.detectFileFormat(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString);
Assert.assertTrue(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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString,
new LoadOptions("@sposeEncrypted_1145"));
Assert.assertEquals("Hello world!", doc.getText().trim());
public void setPassword(java.lang.String value)
Remarks:
In order to save document without encryption this property should be null or empty string.
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.setPassword("@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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString, saveOptions);
FileFormatInfo docInfo = FileFormatUtil.detectFileFormat(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString);
Assert.assertTrue(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(getArtifactsDir() + "OdtSaveOptions.Encrypt" + extensionString,
new LoadOptions("@sposeEncrypted_1145"));
Assert.assertEquals("Hello world!", doc.getText().trim());
value - A password to encrypt document.public DigitalSignatureDetails getDigitalSignatureDetails()
DigitalSignatureDetails object used to sign a document.DigitalSignatureDetails object used to sign a document.public void setDigitalSignatureDetails(DigitalSignatureDetails value)
DigitalSignatureDetails object used to sign a document.value - DigitalSignatureDetails object used to sign a document.