Aspose::Words::Replacing::FindReplaceOptions class
Contents
[
Hide
]FindReplaceOptions class
Specifies options for find/replace operations. To learn more, visit the Find and Replace documentation article.
class FindReplaceOptions : public System::Object
Methods
Method | Description |
---|---|
FindReplaceOptions() | Initializes a new instance of the FindReplaceOptions class with default settings. |
FindReplaceOptions(Aspose::Words::Replacing::FindReplaceDirection) | Initializes a new instance of the FindReplaceOptions class with the specified direction. |
FindReplaceOptions(const System::SharedPtr<Aspose::Words::Replacing::IReplacingCallback>&) | Initializes a new instance of the FindReplaceOptions class with the specified replacing callback. |
FindReplaceOptions(Aspose::Words::Replacing::FindReplaceDirection, const System::SharedPtr<Aspose::Words::Replacing::IReplacingCallback>&) | Initializes a new instance of the FindReplaceOptions class with the specified direction and replacing callback. |
get_ApplyFont() const | Text formatting applied to new content. |
get_ApplyParagraphFormat() const | Paragraph formatting applied to new content. |
get_Direction() const | Selects direction for replace. Default value is Forward. |
get_FindWholeWordsOnly() const | True indicates the oldValue must be a standalone word. |
get_IgnoreDeleted() const | Gets or sets a boolean value indicating either to ignore text inside delete revisions. The default value is false. |
get_IgnoreFieldCodes() const | Gets or sets a boolean value indicating either to ignore text inside field codes. The default value is false. |
get_IgnoreFields() const | Gets or sets a boolean value indicating either to ignore text inside fields. The default value is false. |
get_IgnoreFootnotes() const | Gets or sets a boolean value indicating either to ignore footnotes. The default value is false. |
get_IgnoreInserted() const | Gets or sets a boolean value indicating either to ignore text inside insert revisions. The default value is false. |
get_IgnoreShapes() const | Gets a boolean value indicating either to ignore shapes within a text. The default value is false. |
get_IgnoreStructuredDocumentTags() const | Gets or sets a boolean value indicating either to ignore content of StructuredDocumentTag. The default value is false. |
get_LegacyMode() const | Gets or sets a boolean value indicating that old find/replace algorithm is used. |
get_MatchCase() const | True indicates case-sensitive comparison, false indicates case-insensitive comparison. |
get_ReplacingCallback() const | The user-defined method which is called before every replace occurrence. |
get_SmartParagraphBreakReplacement() const | Gets or sets a boolean value indicating either it is allowed to replace paragraph break when there is no next sibling paragraph. The default value is false. |
get_UseLegacyOrder() const | True indicates that a text search is performed sequentially from top to bottom considering the text boxes. Default value is false. |
get_UseSubstitutions() const | Gets or sets a boolean value indicating whether to recognize and use substitutions within replacement patterns. The default value is false. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
set_Direction(Aspose::Words::Replacing::FindReplaceDirection) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_Direction. |
set_FindWholeWordsOnly(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_FindWholeWordsOnly. |
set_IgnoreDeleted(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreDeleted. |
set_IgnoreFieldCodes(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreFieldCodes. |
set_IgnoreFields(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreFields. |
set_IgnoreFootnotes(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreFootnotes. |
set_IgnoreInserted(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreInserted. |
set_IgnoreShapes(bool) | Sets a boolean value indicating either to ignore shapes within a text. The default value is false. |
set_IgnoreStructuredDocumentTags(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreStructuredDocumentTags. |
set_LegacyMode(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_LegacyMode. |
set_MatchCase(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_MatchCase. |
set_ReplacingCallback(const System::SharedPtr<Aspose::Words::Replacing::IReplacingCallback>&) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_ReplacingCallback. |
set_SmartParagraphBreakReplacement(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_SmartParagraphBreakReplacement. |
set_UseLegacyOrder(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_UseLegacyOrder. |
set_UseSubstitutions(bool) | Setter for Aspose::Words::Replacing::FindReplaceOptions::get_UseSubstitutions. |
static Type() |
Examples
Shows how to toggle case sensitivity when performing a find-and-replace operation.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Ruby bought a ruby necklace.");
// We can use a "FindReplaceOptions" object to modify the find-and-replace process.
auto options = MakeObject<FindReplaceOptions>();
// Set the "MatchCase" flag to "true" to apply case sensitivity while finding strings to replace.
// Set the "MatchCase" flag to "false" to ignore character case while searching for text to replace.
options->set_MatchCase(matchCase);
doc->get_Range()->Replace(u"Ruby", u"Jade", options);
ASSERT_EQ(matchCase ? String(u"Jade bought a ruby necklace.") : String(u"Jade bought a Jade necklace."), doc->GetText().Trim());
Shows how to toggle standalone word-only find-and-replace operations.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Jackson will meet you in Jacksonville.");
// We can use a "FindReplaceOptions" object to modify the find-and-replace process.
auto options = MakeObject<FindReplaceOptions>();
// Set the "FindWholeWordsOnly" flag to "true" to replace the found text if it is not a part of another word.
// Set the "FindWholeWordsOnly" flag to "false" to replace all text regardless of its surroundings.
options->set_FindWholeWordsOnly(findWholeWordsOnly);
doc->get_Range()->Replace(u"Jackson", u"Louis", options);
ASSERT_EQ(findWholeWordsOnly ? String(u"Louis will meet you in Jacksonville.") : String(u"Louis will meet you in Louisville."), doc->GetText().Trim());
See Also
- Namespace Aspose::Words::Replacing
- Library Aspose.Words for C++