Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreOfficeMath method

FindReplaceOptions::get_IgnoreOfficeMath method

Gets or sets a boolean value indicating either to ignore text inside OfficeMath/>. The default value is true.

bool Aspose::Words::Replacing::FindReplaceOptions::get_IgnoreOfficeMath() const

Examples

Shows how to find and replace text within OfficeMath.

auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Office math.docx");

ASSERT_EQ(u"i+b-c≥iM+bM-cM", doc->get_FirstSection()->get_Body()->get_FirstParagraph()->GetText().Trim());

auto options = System::MakeObject<Aspose::Words::Replacing::FindReplaceOptions>();
options->set_IgnoreOfficeMath(isIgnoreOfficeMath);
doc->get_Range()->Replace(u"b", u"x", options);

if (isIgnoreOfficeMath)
{
    ASSERT_EQ(u"i+b-c≥iM+bM-cM", doc->get_FirstSection()->get_Body()->get_FirstParagraph()->GetText().Trim());
}
else
{
    ASSERT_EQ(u"i+x-c≥iM+xM-cM", doc->get_FirstSection()->get_Body()->get_FirstParagraph()->GetText().Trim());
}

See Also