Aspose::Words::Replacing::FindReplaceOptions::set_IgnoreOfficeMath method

FindReplaceOptions::set_IgnoreOfficeMath method

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

void Aspose::Words::Replacing::FindReplaceOptions::set_IgnoreOfficeMath(bool value)

Examples

Shows how to find and replace text within OfficeMath.

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

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

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(doc->get_FirstSection()->get_Body()->get_FirstParagraph()->GetText().Trim(), u"i+b-c≥iM+bM-cM");
}
else
{
    ASSERT_EQ(doc->get_FirstSection()->get_Body()->get_FirstParagraph()->GetText().Trim(), u"i+x-c≥iM+xM-cM");
}

See Also