Trying to figure out how to modify text parameters (e.g. Bold/Italics/etc) for existing text. I get a SUCCESS return from ReplaceTextPart(), but there is no change in the "italics" setting...
ITextEditP editor = eeh.GetITextEdit(); if (editor && editor->IsTextElement(eeh)) { TextBlockPtr textBlock = TextHandlerBase::GetFirstTextPartValue(eeh); if (textBlock.IsValid()) { RunPropertiesR runProps = textBlock->GetRunPropertiesForAddR(); runProps.SetIsItalic(true); textBlock->SetRunPropertiesForAdd(runProps); textBlock->PerformLayout(); } T_ITextPartIdPtrVector partIDs; editor->GetTextPartIds(eeh,*ITextQueryOptions::CreateDefault(), partIDs); ITextEdit::ReplaceStatus rStatus = editor->ReplaceTextPart(eeh, *partIDs[0], *textBlock); wprintf(L"rStatus=%d\n", rStatus); }
Calling ITextEdit::ReplaceTextPart isn't enough to replace the text. Suffixing a call of eeh.ReplaceInModel can make your code worked.