Question
How to change a single character's color and font style in the sentence?
Answer
The following C++ code will deal with the task:
CSafePtr<ICharParams> charparams;
CheckResult(FREngine->CreateCharParams(&charparams));
CheckResult(charparams->put_Color(165536));
CheckResult(charparams->put_IsItalic(VARIANT_TRUE));
CheckResult(par->SetCharParams(1, 1, charparams, CFL_Proofed, SF_Color | SF_Italic));
// Done for the 2nd character in the paragraph
Note: Don't obtain ICharParams object from the paragraph using
IParagraph::GetCharParams(int Position, ICharParams* Result)!
In this case, any word in the paragraph would undergo style changing.
Comments
0 comments
Please sign in to leave a comment.