Hello,
I have a problem with ParagraphStyles and the DefaultAttr.
I create two ParapgraphStyles like this:
Code
Style:=RichText.ParStyles.AddStyle('MSGTITLE');Style.ASetAddCharStyle(WPSTY_BOLD);Style:=RichText.ParStyles.AddStyle('MSGTEXT');Style.ASetDelCharStyle(WPSTY_BOLD);
Both should be derived from the DefaultAttr.
At first this seems to work. I'm using this code to add paragraphs to the rtf control:
Code
if RichText.IsEmpty then Par:=RichText.LastPar
else Par:=RichText.LastPar.AppendNewPar;
Par.ABaseStyleName:='MSGTITLE';
Par.SetText('['+Time2Str(TimeGetTime)+'] '+Match+':');
Par:=Par.AppendNewPar;
Par.ABaseStyleName:='MSGTEXT';
RichText.CPPosition:=MaxInt;
RichText.SelectionAsString:=Msg;
The variable Msg can be RTF-Text. If this is the case and the font differs from the DefaultAttr, then the next time I add a new paragraph, the Style MSGTITLE isn't derived from DefaultAttr anymore, but from this new font style.
So my question is:
Can I add a new ParagraphStyle as a real copy of the DefaultAttr?
Or is it possible to set the font back to DefaultAttr after SelectionAsString:=Msg?
Regards,
Björn