Aspose::Words::ImportFormatOptions class
Contents
[
Hide
]ImportFormatOptions class
Allows to specify various import options to format output. To learn more, visit the Specify Load Options documentation article.
class ImportFormatOptions : public System::Object
Methods
Method | Description |
---|---|
get_AdjustSentenceAndWordSpacing() const | Gets a boolean value that specifies whether to adjust sentence and word spacing automatically. The default value is false. |
get_ForceCopyStyles() const | Gets or sets a boolean value indicating either to copy conflicting styles in KeepSourceFormatting mode. The default value is false. |
get_IgnoreHeaderFooter() const | Gets or sets a boolean value that specifies that source formatting of headers/footers content ignored if KeepSourceFormatting mode is used. The default value is true. |
get_IgnoreTextBoxes() const | Gets or sets a boolean value that specifies that source formatting of textboxes content ignored if KeepSourceFormatting mode is used. The default value is true. |
get_KeepSourceNumbering() const | Gets or sets a boolean value that specifies how the numbering will be imported when it clashes in source and destination documents. The default value is false. |
get_MergePastedLists() const | Gets or sets a boolean value that specifies whether pasted lists will be merged with surrounding lists. The default value is false. |
get_SmartStyleBehavior() const | Gets or sets a boolean value that specifies how styles will be imported when they have equal names in source and destination documents. The default value is false. |
GetType() const override | |
ImportFormatOptions() | |
Is(const System::TypeInfo&) const override | |
set_AdjustSentenceAndWordSpacing(bool) | Sets a boolean value that specifies whether to adjust sentence and word spacing automatically. The default value is false. |
set_ForceCopyStyles(bool) | Setter for Aspose::Words::ImportFormatOptions::get_ForceCopyStyles. |
set_IgnoreHeaderFooter(bool) | Setter for Aspose::Words::ImportFormatOptions::get_IgnoreHeaderFooter. |
set_IgnoreTextBoxes(bool) | Setter for Aspose::Words::ImportFormatOptions::get_IgnoreTextBoxes. |
set_KeepSourceNumbering(bool) | Setter for Aspose::Words::ImportFormatOptions::get_KeepSourceNumbering. |
set_MergePastedLists(bool) | Setter for Aspose::Words::ImportFormatOptions::get_MergePastedLists. |
set_SmartStyleBehavior(bool) | Setter for Aspose::Words::ImportFormatOptions::get_SmartStyleBehavior. |
static Type() |
Examples
Shows how to resolve duplicate styles while inserting documents.
auto dstDoc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(dstDoc);
SharedPtr<Style> myStyle = builder->get_Document()->get_Styles()->Add(StyleType::Paragraph, u"MyStyle");
myStyle->get_Font()->set_Size(14);
myStyle->get_Font()->set_Name(u"Courier New");
myStyle->get_Font()->set_Color(System::Drawing::Color::get_Blue());
builder->get_ParagraphFormat()->set_StyleName(myStyle->get_Name());
builder->Writeln(u"Hello world!");
// Clone the document and edit the clone's "MyStyle" style, so it is a different color than that of the original.
// If we insert the clone into the original document, the two styles with the same name will cause a clash.
SharedPtr<Document> srcDoc = dstDoc->Clone();
srcDoc->get_Styles()->idx_get(u"MyStyle")->get_Font()->set_Color(System::Drawing::Color::get_Red());
// When we enable SmartStyleBehavior and use the KeepSourceFormatting import format mode,
// Aspose.Words will resolve style clashes by converting source document styles.
// with the same names as destination styles into direct paragraph attributes.
auto options = MakeObject<ImportFormatOptions>();
options->set_SmartStyleBehavior(true);
builder->InsertDocument(srcDoc, ImportFormatMode::KeepSourceFormatting, options);
dstDoc->Save(ArtifactsDir + u"DocumentBuilder.SmartStyleBehavior.docx");
See Also
- Namespace Aspose::Words
- Library Aspose.Words for C++