[CONNECT C++] Modifying Text Properties

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();
	T_ITextPartIdPtrVector		partIDs;
	editor->GetTextPartIds(eeh,*ITextQueryOptions::CreateDefault(), partIDs);
	ITextEdit::ReplaceStatus  rStatus = editor->ReplaceTextPart(eeh, *partIDs[0], *textBlock);
	wprintf(L"rStatus=%d\n", rStatus);

  • Help tells us this about SetRunPropertiesForAdd(runProps): Gets the run properties that will be used when any future run DOM nodes are created

    I don't see any method that sets the Run properties for editing in an existing block. I suppose we have to …

    • Set the properties
    • Create a new Run
    • Copy the bits we want
    • Replace that Run in the TextBlock

    Regards, Jon Summers
    LA Solutions

  • Replace that Run in the TextBlock

    I guess that is the real question/issue. How is this done? Does replacing the Run in the TextBlock mean we have to "create" a whole NEW TextBlock (with our desired TextBlock, Paragraph and Run properties) then insert our text items (TextBlock::InsertText() calls)?