Question about StyleTemplates / implement Word like handling

General TRichView support forum. Please post your questions here
Post Reply
a.weber
Posts: 63
Joined: Wed Mar 02, 2022 7:02 am

Question about StyleTemplates / implement Word like handling

Post by a.weber »

Hello,
I'am trying to use StyleTemplate to get a word like editor. For learning I use the sample from "DelphiUnicode\Editors\StyleTemplates". I thought if I apply the "Standard" (translated to german) or so called "Normal" template to the selected text it resets everything to this defaults - font/color/size, paragraph properties and so on like word does it.
But currently it resets only the paragraph properties - because the "Normal" ST has Kind=rvstkPara, which couldn't ne changed -> because of the Name. Can you explain me why?
Why can't be the ST "Normal" not also an Kind=rvstkParaText?

thanks in advance
André
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Question about StyleTemplates / implement Word like handling

Post by Sergey Tkachenko »

Paragraph ST can contain both text and paragraph attributes. When you apply a paragraph ST to a paragraph, text attributes of this ST are applied to all text in this paragraph.
The only difference between paragraph ST and text+paragraph ST is a possibility to apply them to a text fragment (i.e., not to a whole paragraph, but to a part of it). It is not possible to for paragraph ST.

There are several special ST with partially predefined behavior. 'Normal' is one of them. It must be a paragraph ST, for consistency with MS Word behavior.

For resetting text properties of a selected text, you can unlink them from ST, by using -1 in the parameter of ST application methods.
a.weber
Posts: 63
Joined: Wed Mar 02, 2022 7:02 am

Re: Question about StyleTemplates / implement Word like handling

Post by a.weber »

Ok - I misinterpreted the property Kind and its meaning - I thought this defines which parts of the selected text are changed by this ST.
But as you explained it only defines on what it could be applied. Now it makes sense to me.

Thanks for the input.
Post Reply