Aspose::Words::Saving::SaveOptions Class Referenceabstract

Detailed Description

This is an abstract base class for classes that allow the user to specify additional options when saving a document into a particular format.

Examples

Shows how to specify saving options while converting a document to .epub.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// Specify encoding for a document that we will save with a SaveOptions object.
auto saveOptions = MakeObject<HtmlSaveOptions>();
saveOptions->set_SaveFormat(SaveFormat::Epub);
saveOptions->set_Encoding(System::Text::Encoding::get_UTF8());
// By default, an output .epub document will have all the contents in one HTML part.
// A split criteria allows us to segment the document into several HTML parts.
// We will set the criteria to split the document at heading paragraphs.
// This is useful for readers which cannot read HTML files greater than a certain size.
saveOptions->set_DocumentSplitCriteria(DocumentSplitCriteria::HeadingParagraph);
// Specify that we want to export document properties.
saveOptions->set_ExportDocumentProperties(true);
doc->Save(ArtifactsDir + u"HtmlSaveOptions.Doc2EpubSaveOptions.epub", saveOptions);
static EncodingPtr get_UTF8()
@ HeadingParagraph
The document is split into parts at a paragraph formatted using a heading style Heading 1,...
@ Epub
Saves the document in the IDPF EPUB format.

#include <Aspose.Words.Cpp/Model/Saving/SaveOptions.h>

+ Inheritance diagram for Aspose::Words::Saving::SaveOptions:

Public Member Functions

bool get_AllowEmbeddingPostScriptFonts () const
 Gets or sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved. The default value is false. More...
 
SharedPtr< TimeZoneInfoget_CustomTimeZoneInfo () const
 
String get_DefaultTemplate () const
 Gets or sets path to default template (including filename). Default value for this property is empty string (Empty). More...
 
Dml3DEffectsRenderingMode get_Dml3DEffectsRenderingMode () const
 Gets a value determining how 3D effects are rendered. More...
 
virtual DmlEffectsRenderingMode get_DmlEffectsRenderingMode ()
 Gets or sets a value determining how DrawingML effects are rendered. More...
 
DmlRenderingMode get_DmlRenderingMode () const
 Gets or sets a value determining how DrawingML shapes are rendered. More...
 
bool get_MemoryOptimization () const
 Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false. More...
 
bool get_PrettyFormat () const
 When true, pretty formats output where applicable. Default value is false. More...
 
virtual SaveFormat get_SaveFormat ()=0
 Specifies the format in which the document will be saved if this save options object is used. More...
 
String get_TempFolder () const
 Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used. More...
 
bool get_UpdateCreatedTimeProperty () const
 
bool get_UpdateFields () const
 Gets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true. More...
 
bool get_UpdateLastPrintedProperty () const
 Gets or sets a value determining whether the LastPrinted property is updated before saving. More...
 
bool get_UpdateLastSavedTimeProperty () const
 Gets or sets a value determining whether the LastSavedTime property is updated before saving. More...
 
bool get_UpdateSdtContent () const
 Gets or sets value determining whether content of StructuredDocumentTag is updated before saving. More...
 
bool get_UseAntiAliasing () const
 Gets or sets a value determining whether or not to use anti-aliasing for rendering. More...
 
bool get_UseHighQualityRendering () const
 Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_AllowEmbeddingPostScriptFonts (bool value)
 Setter for get_AllowEmbeddingPostScriptFonts. More...
 
void set_CustomTimeZoneInfo (SharedPtr< TimeZoneInfo > value)
 
void set_DefaultTemplate (String value)
 Setter for get_DefaultTemplate. More...
 
void set_Dml3DEffectsRenderingMode (Dml3DEffectsRenderingMode value)
 Sets a value determining how 3D effects are rendered. More...
 
virtual void set_DmlEffectsRenderingMode (DmlEffectsRenderingMode value)
 Setter for get_DmlEffectsRenderingMode. More...
 
void set_DmlRenderingMode (DmlRenderingMode value)
 Setter for get_DmlRenderingMode. More...
 
void set_MemoryOptimization (bool value)
 Setter for get_MemoryOptimization. More...
 
void set_PrettyFormat (bool value)
 Setter for get_PrettyFormat. More...
 
virtual void set_SaveFormat (SaveFormat value)=0
 Setter for get_SaveFormat. More...
 
void set_TempFolder (String value)
 Setter for get_TempFolder. More...
 
void set_UpdateCreatedTimeProperty (bool value)
 
void set_UpdateFields (bool value)
 Setter for get_UpdateFields. More...
 
void set_UpdateLastPrintedProperty (bool value)
 Setter for get_UpdateLastPrintedProperty. More...
 
void set_UpdateLastSavedTimeProperty (bool value)
 Setter for get_UpdateLastSavedTimeProperty. More...
 
void set_UpdateSdtContent (bool value)
 Setter for get_UpdateSdtContent. More...
 
void set_UseAntiAliasing (bool value)
 Setter for get_UseAntiAliasing. More...
 
void set_UseHighQualityRendering (bool value)
 Setter for get_UseHighQualityRendering. More...
 
- Public Member Functions inherited from Object
 Object ()
 
 Object (Object const &x)
 
virtual ~Object ()
 
virtual bool Equals (ptr obj)
 
virtual bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 
Detail::SmartPtrCounter * GetCounter ()
 
virtual int32_t GetHashCode () const
 
void Lock ()
 
virtual ptr MemberwiseClone () const
 
Objectoperator= (Object const &x)
 
bool ReferenceEquals (String const &str, std::nullptr_t)
 
bool ReferenceEquals (String const &str1, String const &str2)
 
int RemovedSharedRefs (int count)
 
virtual void SetTemplateWeakPtr (unsigned int argument)
 
int SharedCount () const
 
ObjectSharedRefAdded ()
 
int SharedRefRemovedSafe ()
 
virtual String ToString () const
 
void Unlock ()
 
Detail::SmartPtrCounter * WeakRefAdded ()
 
void WeakRefRemoved ()
 

Static Public Member Functions

static SharedPtr< SaveOptionsCreateSaveOptions (SaveFormat saveFormat)
 Creates a save options object of a class suitable for the specified save format. More...
 
static SharedPtr< SaveOptionsCreateSaveOptions (String fileName)
 Creates a save options object of a class suitable for the file extension specified in the given file name. More...
 
static const TypeInfoType ()
 
- Static Public Member Functions inherited from Object
bool Equals (double const &objA, double const &objB)
 
bool Equals (float const &objA, float const &objB)
 
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 
static const TypeInfoType ()
 

Additional Inherited Members

- Public Types inherited from Object
typedef SmartPtr< Objectptr
 
typedef System::Details::SharedMembersType shared_members_type
 

Member Function Documentation

◆ CreateSaveOptions() [1/2]

static System::SharedPtr<Aspose::Words::Saving::SaveOptions> Aspose::Words::Saving::SaveOptions::CreateSaveOptions ( Aspose::Words::SaveFormat  saveFormat)
static

Creates a save options object of a class suitable for the specified save format.

Parameters
saveFormatThe save format for which to create a save options object.
Returns
An object of a class that derives from SaveOptions.
Examples

Shows an option to optimize memory consumption when you work with large documents.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// When set to true it will improve document memory footprint but will add extra time to processing
SharedPtr<SaveOptions> saveOptions = SaveOptions::CreateSaveOptions(SaveFormat::Pdf);
saveOptions->set_MemoryOptimization(true);
doc->Save(ArtifactsDir + u"PdfSaveOptions.MemoryOptimization.pdf", saveOptions);
static System::SharedPtr< Aspose::Words::Saving::SaveOptions > CreateSaveOptions(Aspose::Words::SaveFormat saveFormat)
Creates a save options object of a class suitable for the specified save format.
@ Pdf
Saves the document as PDF (Adobe Portable Document) format.

◆ CreateSaveOptions() [2/2]

static System::SharedPtr<Aspose::Words::Saving::SaveOptions> Aspose::Words::Saving::SaveOptions::CreateSaveOptions ( System::String  fileName)
static

Creates a save options object of a class suitable for the file extension specified in the given file name.

Parameters
fileNameThe extension of this file name determines the class of the save options object to create.
Returns
An object of a class that derives from SaveOptions.
Examples

Shows how to set a default template for documents that do not have attached templates.

auto doc = MakeObject<Document>();
// Enable automatic style updating, but do not attach a template document.
doc->set_AutomaticallyUpdateStyles(true);
ASSERT_EQ(String::Empty, doc->get_AttachedTemplate());
// Since there is no template document, the document had nowhere to track style changes.
// Use a SaveOptions object to automatically set a template
// if a document that we are saving does not have one.
SharedPtr<SaveOptions> options = SaveOptions::CreateSaveOptions(u"Document.DefaultTemplate.docx");
options->set_DefaultTemplate(MyDir + u"Business brochure.dotx");
doc->Save(ArtifactsDir + u"Document.DefaultTemplate.docx", options);

◆ get_AllowEmbeddingPostScriptFonts()

bool Aspose::Words::Saving::SaveOptions::get_AllowEmbeddingPostScriptFonts ( ) const

Gets or sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved. The default value is false.

Note, Word does not embed PostScript fonts, but can open documents with embedded fonts of this type.

This option only works when EmbedTrueTypeFonts of the FontInfos property is set to true.

◆ get_CustomTimeZoneInfo()

System::SharedPtr<System::TimeZoneInfo> Aspose::Words::Saving::SaveOptions::get_CustomTimeZoneInfo ( ) const

◆ get_DefaultTemplate()

System::String Aspose::Words::Saving::SaveOptions::get_DefaultTemplate ( ) const

Gets or sets path to default template (including filename). Default value for this property is empty string (Empty).

Examples

Shows how to set a default template for documents that do not have attached templates.

auto doc = MakeObject<Document>();
// Enable automatic style updating, but do not attach a template document.
doc->set_AutomaticallyUpdateStyles(true);
ASSERT_EQ(String::Empty, doc->get_AttachedTemplate());
// Since there is no template document, the document had nowhere to track style changes.
// Use a SaveOptions object to automatically set a template
// if a document that we are saving does not have one.
SharedPtr<SaveOptions> options = SaveOptions::CreateSaveOptions(u"Document.DefaultTemplate.docx");
options->set_DefaultTemplate(MyDir + u"Business brochure.dotx");
doc->Save(ArtifactsDir + u"Document.DefaultTemplate.docx", options);

◆ get_Dml3DEffectsRenderingMode()

Aspose::Words::Saving::Dml3DEffectsRenderingMode Aspose::Words::Saving::SaveOptions::get_Dml3DEffectsRenderingMode ( ) const

Gets a value determining how 3D effects are rendered.

◆ get_DmlEffectsRenderingMode()

virtual Aspose::Words::Saving::DmlEffectsRenderingMode Aspose::Words::Saving::SaveOptions::get_DmlEffectsRenderingMode ( )
virtual

Gets or sets a value determining how DrawingML effects are rendered.

The default value is Simplified.

This property is used when the document is exported to fixed page formats.

Examples

Shows how to configure DrawingML rendering quality with PdfSaveOptions.

auto doc = MakeObject<Document>(MyDir + u"DrawingML shape effects.docx");
auto options = MakeObject<PdfSaveOptions>();
options->set_DmlEffectsRenderingMode(effectsRenderingMode);
ASSERT_EQ(DmlRenderingMode::DrawingML, options->get_DmlRenderingMode());
doc->Save(ArtifactsDir + u"PdfSaveOptions.DrawingMLEffects.pdf", options);
@ DrawingML
Aspose.Words ignores fall-back shape of DrawingML and renders DrawingML itself. This is the default m...

Reimplemented in Aspose::Words::Saving::PdfSaveOptions.

◆ get_DmlRenderingMode()

Aspose::Words::Saving::DmlRenderingMode Aspose::Words::Saving::SaveOptions::get_DmlRenderingMode ( ) const

Gets or sets a value determining how DrawingML shapes are rendered.

The default value is Fallback.

This property is used when the document is exported to fixed page formats.

Examples

Shows how to configure DrawingML rendering quality with PdfSaveOptions.

auto doc = MakeObject<Document>(MyDir + u"DrawingML shape effects.docx");
auto options = MakeObject<PdfSaveOptions>();
options->set_DmlEffectsRenderingMode(effectsRenderingMode);
ASSERT_EQ(DmlRenderingMode::DrawingML, options->get_DmlRenderingMode());
doc->Save(ArtifactsDir + u"PdfSaveOptions.DrawingMLEffects.pdf", options);

Shows how to render fallback shapes when saving to Pdf.

auto doc = MakeObject<Document>(MyDir + u"DrawingML shape fallbacks.docx");
auto options = MakeObject<PdfSaveOptions>();
options->set_DmlRenderingMode(dmlRenderingMode);
doc->Save(ArtifactsDir + u"PdfSaveOptions.DrawingMLFallback.pdf", options);

◆ get_MemoryOptimization()

bool Aspose::Words::Saving::SaveOptions::get_MemoryOptimization ( ) const

Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false.

Examples

Shows an option to optimize memory consumption when you work with large documents.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// When set to true it will improve document memory footprint but will add extra time to processing
SharedPtr<SaveOptions> saveOptions = SaveOptions::CreateSaveOptions(SaveFormat::Pdf);
saveOptions->set_MemoryOptimization(true);
doc->Save(ArtifactsDir + u"PdfSaveOptions.MemoryOptimization.pdf", saveOptions);

◆ get_PrettyFormat()

bool Aspose::Words::Saving::SaveOptions::get_PrettyFormat ( ) const

When true, pretty formats output where applicable. Default value is false.

Set to true to make HTML, MHTML, EPUB, WordML, RTF, DOCX and ODT output human readable. Useful for testing or debugging.

Examples

Shows how to enhance the readability of the raw code of a saved .html document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Hello world!");
// Enable pretty format via a SaveOptions object, then save the document in .html to the local file system.
auto htmlOptions = MakeObject<HtmlSaveOptions>(SaveFormat::Html);
htmlOptions->set_PrettyFormat(usePrettyFormat);
doc->Save(ArtifactsDir + u"HtmlSaveOptions.PrettyFormat.html", htmlOptions);
// Enabling pretty format makes the raw html code more readable by adding tab stop and new line characters.
String html = System::IO::File::ReadAllText(ArtifactsDir + u"HtmlSaveOptions.PrettyFormat.html");
if (usePrettyFormat)
{
ASSERT_EQ(String(u"<html>\r\n") + u"\t<head>\r\n" + u"\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n" +
u"\t\t<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\r\n" +
String::Format(u"\t\t<meta name=\"generator\" content=\"{0} {1}\" />\r\n", BuildVersionInfo::get_Product(),
u"\t\t<title>\r\n" + u"\t\t</title>\r\n" + u"\t</head>\r\n" +
u"\t<body style=\"font-family:'Times New Roman'; font-size:12pt\">\r\n" + u"\t\t<div>\r\n" +
u"\t\t\t<p style=\"margin-top:0pt; margin-bottom:0pt\">\r\n" + u"\t\t\t\t<span>Hello world!</span>\r\n" + u"\t\t\t</p>\r\n" +
u"\t\t\t<p style=\"margin-top:0pt; margin-bottom:0pt\">\r\n" + u"\t\t\t\t<span style=\"-aw-import:ignore\">&#xa0;</span>\r\n" +
u"\t\t\t</p>\r\n" + u"\t\t</div>\r\n" + u"\t</body>\r\n</html>",
html);
}
else
{
ASSERT_EQ(String(u"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />") +
u"<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />" +
String::Format(u"<meta name=\"generator\" content=\"{0} {1}\" /><title></title></head>", BuildVersionInfo::get_Product(),
u"<body style=\"font-family:'Times New Roman'; font-size:12pt\">" +
u"<div><p style=\"margin-top:0pt; margin-bottom:0pt\"><span>Hello world!</span></p>" +
u"<p style=\"margin-top:0pt; margin-bottom:0pt\"><span style=\"-aw-import:ignore\">&#xa0;</span></p></div></body></html>",
html);
}
static String ReadAllText(const String &path, const EncodingPtr &encoding=Text::Encoding::get_UTF8())
static System::String get_Product()
Gets the full name of the product.
static System::String get_Version()
Gets the product version.
@ Html
Saves the document in the HTML format.

◆ get_SaveFormat()

virtual Aspose::Words::SaveFormat Aspose::Words::Saving::SaveOptions::get_SaveFormat ( )
pure virtual

Specifies the format in which the document will be saved if this save options object is used.

Examples

Shows how to specify saving options while converting a document to .epub.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// Specify encoding for a document that we will save with a SaveOptions object.
auto saveOptions = MakeObject<HtmlSaveOptions>();
saveOptions->set_SaveFormat(SaveFormat::Epub);
saveOptions->set_Encoding(System::Text::Encoding::get_UTF8());
// By default, an output .epub document will have all the contents in one HTML part.
// A split criteria allows us to segment the document into several HTML parts.
// We will set the criteria to split the document at heading paragraphs.
// This is useful for readers which cannot read HTML files greater than a certain size.
saveOptions->set_DocumentSplitCriteria(DocumentSplitCriteria::HeadingParagraph);
// Specify that we want to export document properties.
saveOptions->set_ExportDocumentProperties(true);
doc->Save(ArtifactsDir + u"HtmlSaveOptions.Doc2EpubSaveOptions.epub", saveOptions);

Implemented in Aspose::Words::Saving::XpsSaveOptions, Aspose::Words::Saving::XamlFlowSaveOptions, Aspose::Words::Saving::XamlFixedSaveOptions, Aspose::Words::Saving::WordML2003SaveOptions, Aspose::Words::Saving::TxtSaveOptions, Aspose::Words::Saving::SvgSaveOptions, Aspose::Words::Saving::RtfSaveOptions, Aspose::Words::Saving::PsSaveOptions, Aspose::Words::Saving::PdfSaveOptions, Aspose::Words::Saving::PclSaveOptions, Aspose::Words::Saving::OoxmlSaveOptions, Aspose::Words::Saving::OdtSaveOptions, Aspose::Words::Saving::MarkdownSaveOptions, Aspose::Words::Saving::ImageSaveOptions, Aspose::Words::Saving::HtmlSaveOptions, Aspose::Words::Saving::HtmlFixedSaveOptions, and Aspose::Words::Saving::DocSaveOptions.

◆ get_TempFolder()

System::String Aspose::Words::Saving::SaveOptions::get_TempFolder ( ) const

Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used.

When Aspose.Words saves a document, it needs to create temporary internal structures. By default, these internal structures are created in memory and the memory usage spikes for a short period while the document is being saved. When saving is complete, the memory is freed and reclaimed by the garbage collector.

If you are saving a very large document (thousands of pages) and/or processing many documents at the same time, then the memory spike during saving can be significant enough to cause the system to throw OutOfMemoryException. Specifying a temporary folder using TempFolder will cause Aspose.Words to keep the internal structures in temporary files instead of memory. It reduces the memory usage during saving, but will decrease the save performance.

The folder must exist and be writable, otherwise an exception will be thrown.

Aspose.Words automatically deletes all temporary files when saving is complete.

Examples

Shows how to use the hard drive instead of memory when saving a document.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// When we save a document, various elements are temporarily stored in memory as the save operation is taking place.
// We can use this option to use a temporary folder in the local file system instead,
// which will reduce our application's memory overhead.
auto options = MakeObject<DocSaveOptions>();
options->set_TempFolder(ArtifactsDir + u"TempFiles");
// The specified temporary folder must exist in the local file system before the save operation.
System::IO::Directory::CreateDirectory_(options->get_TempFolder());
doc->Save(ArtifactsDir + u"DocSaveOptions.TempFolder.doc", options);
// The folder will persist with no residual contents from the load operation.
ASSERT_EQ(0, System::IO::Directory::GetFiles(options->get_TempFolder())->get_Length());
static void CreateDirectory_(const String &path)
static ArrayPtr< String > GetFiles(const String &path, const String &searchPattern=u"*", SearchOption searchOption=SearchOption::TopDirectoryOnly)

◆ get_UpdateCreatedTimeProperty()

bool Aspose::Words::Saving::SaveOptions::get_UpdateCreatedTimeProperty ( ) const

◆ get_UpdateFields()

bool Aspose::Words::Saving::SaveOptions::get_UpdateFields ( ) const

Gets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true.

Examples

Shows how to update fields before saving into a PDF document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert two pages of text, including two fields that will need to be updated to display an accurate value
builder->Write(u"Page ");
builder->InsertField(u"PAGE", u"");
builder->Write(u" of ");
builder->InsertField(u"NUMPAGES", u"");
builder->InsertBreak(BreakType::PageBreak);
builder->Writeln(u"Hello World!");
auto options = MakeObject<PdfSaveOptions>();
options->set_UpdateFields(doUpdateFields);
// PdfSaveOptions objects can be cloned
ASPOSE_ASSERT_NS(options, options->Clone());
doc->Save(ArtifactsDir + u"PdfSaveOptions.UpdateFields.pdf", options);
@ PageBreak
Explicit page break.

◆ get_UpdateLastPrintedProperty()

bool Aspose::Words::Saving::SaveOptions::get_UpdateLastPrintedProperty ( ) const

Gets or sets a value determining whether the LastPrinted property is updated before saving.

Examples

Shows how to update a document's "Last printed" property when saving.

auto doc = MakeObject<Document>();
// This flag determines whether the last printed date, which is a built-in property, is updated.
// If so, then the date of the document's most recent save operation
// with this SaveOptions object passed as a parameter is used as the print date.
auto saveOptions = MakeObject<DocSaveOptions>();
saveOptions->set_UpdateLastPrintedProperty(isUpdateLastPrintedProperty);
// In Microsoft Word 2003, this property can be found via File -> Properties -> Statistics -> Printed.
// It can also be displayed in the document's body by using a PRINTDATE field.
doc->Save(ArtifactsDir + u"DocSaveOptions.UpdateLastPrintedProperty.doc", saveOptions);
// Open the saved document, then verify the value of the property.
doc = MakeObject<Document>(ArtifactsDir + u"DocSaveOptions.UpdateLastPrintedProperty.doc");
ASPOSE_ASSERT_NE(isUpdateLastPrintedProperty, (System::DateTime::MinValue.get_Date() == doc->get_BuiltInDocumentProperties()->get_LastPrinted()));
static const DateTime MinValue

◆ get_UpdateLastSavedTimeProperty()

bool Aspose::Words::Saving::SaveOptions::get_UpdateLastSavedTimeProperty ( ) const

Gets or sets a value determining whether the LastSavedTime property is updated before saving.

Examples

Shows how to update a document time property when you want to save it.

auto doc = MakeObject<Document>(MyDir + u"Document.docx");
// Get last saved time
System::DateTime documentTimeBeforeSave = doc->get_BuiltInDocumentProperties()->get_LastSavedTime();
auto saveOptions = MakeObject<OoxmlSaveOptions>();
saveOptions->set_UpdateLastSavedTimeProperty(true);
doc->Save(ArtifactsDir + u"OoxmlSaveOptions.UpdatingLastSavedTimeDocument.docx", saveOptions);

◆ get_UpdateSdtContent()

bool Aspose::Words::Saving::SaveOptions::get_UpdateSdtContent ( ) const

Gets or sets value determining whether content of StructuredDocumentTag is updated before saving.

Examples

Shows how structured document tags can be updated while saving to .pdf.

auto doc = MakeObject<Document>();
// Insert two StructuredDocumentTags; a date and a drop-down list
auto tag = MakeObject<StructuredDocumentTag>(doc, SdtType::Date, MarkupLevel::Block);
tag->set_FullDate(System::DateTime::get_Now());
doc->get_FirstSection()->get_Body()->AppendChild(tag);
tag = MakeObject<StructuredDocumentTag>(doc, SdtType::DropDownList, MarkupLevel::Block);
tag->get_ListItems()->Add(MakeObject<SdtListItem>(u"Value 1"));
tag->get_ListItems()->Add(MakeObject<SdtListItem>(u"Value 2"));
tag->get_ListItems()->Add(MakeObject<SdtListItem>(u"Value 3"));
tag->get_ListItems()->set_SelectedValue(tag->get_ListItems()->idx_get(1));
doc->get_FirstSection()->get_Body()->AppendChild(tag);
// We've selected default values for both tags
// We can save those values in the document without immediately updating the tags, leaving them in their default state
// by using a SaveOptions object with this flag set
auto options = MakeObject<PdfSaveOptions>();
options->set_UpdateSdtContent(updateSdtContent);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.UpdateSdtContent.pdf", options);
static DateTime get_Now()

◆ get_UseAntiAliasing()

bool Aspose::Words::Saving::SaveOptions::get_UseAntiAliasing ( ) const

Gets or sets a value determining whether or not to use anti-aliasing for rendering.

The default value is false. When this value is set to true anti-aliasing is used for rendering.

This property is used when the document is exported to the following formats: Tiff, Png, Bmp, Jpeg, Emf. When the document is exported to the Html, Mhtml and Epub formats this option is used for raster images.

Examples

Shows how to improve the quality of a rendered document with SaveOptions.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Size(60);
builder->Writeln(u"Some text.");
SharedPtr<SaveOptions> options = MakeObject<Aspose::Words::Saving::ImageSaveOptions>(SaveFormat::Jpeg);
doc->Save(ArtifactsDir + u"Document.ImageSaveOptions.Default.jpg", options);
options->set_UseAntiAliasing(true);
options->set_UseHighQualityRendering(true);
doc->Save(ArtifactsDir + u"Document.ImageSaveOptions.HighQuality.jpg", options);
@ Jpeg
Renders a page of the document and saves it as a JPEG file.

◆ get_UseHighQualityRendering()

bool Aspose::Words::Saving::SaveOptions::get_UseHighQualityRendering ( ) const

Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.

The default value is false.

This property is used when the document is exported to image formats: Tiff, Png, Bmp, Jpeg, Emf.

Examples

Shows how to improve the quality of a rendered document with SaveOptions.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Size(60);
builder->Writeln(u"Some text.");
SharedPtr<SaveOptions> options = MakeObject<Aspose::Words::Saving::ImageSaveOptions>(SaveFormat::Jpeg);
doc->Save(ArtifactsDir + u"Document.ImageSaveOptions.Default.jpg", options);
options->set_UseAntiAliasing(true);
options->set_UseHighQualityRendering(true);
doc->Save(ArtifactsDir + u"Document.ImageSaveOptions.HighQuality.jpg", options);

◆ GetType()

◆ Is()

◆ set_AllowEmbeddingPostScriptFonts()

void Aspose::Words::Saving::SaveOptions::set_AllowEmbeddingPostScriptFonts ( bool  value)

◆ set_CustomTimeZoneInfo()

void Aspose::Words::Saving::SaveOptions::set_CustomTimeZoneInfo ( System::SharedPtr< System::TimeZoneInfo value)

◆ set_DefaultTemplate()

void Aspose::Words::Saving::SaveOptions::set_DefaultTemplate ( System::String  value)

◆ set_Dml3DEffectsRenderingMode()

void Aspose::Words::Saving::SaveOptions::set_Dml3DEffectsRenderingMode ( Aspose::Words::Saving::Dml3DEffectsRenderingMode  value)

Sets a value determining how 3D effects are rendered.

◆ set_DmlEffectsRenderingMode()

virtual void Aspose::Words::Saving::SaveOptions::set_DmlEffectsRenderingMode ( Aspose::Words::Saving::DmlEffectsRenderingMode  value)
virtual

◆ set_DmlRenderingMode()

void Aspose::Words::Saving::SaveOptions::set_DmlRenderingMode ( Aspose::Words::Saving::DmlRenderingMode  value)

◆ set_MemoryOptimization()

void Aspose::Words::Saving::SaveOptions::set_MemoryOptimization ( bool  value)

◆ set_PrettyFormat()

void Aspose::Words::Saving::SaveOptions::set_PrettyFormat ( bool  value)

◆ set_SaveFormat()

◆ set_TempFolder()

void Aspose::Words::Saving::SaveOptions::set_TempFolder ( System::String  value)

◆ set_UpdateCreatedTimeProperty()

void Aspose::Words::Saving::SaveOptions::set_UpdateCreatedTimeProperty ( bool  value)

◆ set_UpdateFields()

void Aspose::Words::Saving::SaveOptions::set_UpdateFields ( bool  value)

◆ set_UpdateLastPrintedProperty()

void Aspose::Words::Saving::SaveOptions::set_UpdateLastPrintedProperty ( bool  value)

◆ set_UpdateLastSavedTimeProperty()

void Aspose::Words::Saving::SaveOptions::set_UpdateLastSavedTimeProperty ( bool  value)

◆ set_UpdateSdtContent()

void Aspose::Words::Saving::SaveOptions::set_UpdateSdtContent ( bool  value)

◆ set_UseAntiAliasing()

void Aspose::Words::Saving::SaveOptions::set_UseAntiAliasing ( bool  value)

◆ set_UseHighQualityRendering()

void Aspose::Words::Saving::SaveOptions::set_UseHighQualityRendering ( bool  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Saving::SaveOptions::Type ( )
static