Setting a Style

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 331
Joined: Fri Jun 18, 2021 3:07 pm

Setting a Style

Post by standay »

Sergey,

Sorry, another styles question!

Say I paste some text in my rve, and it has the Georgia font. If I select the whole paragraph and then use the style combo to set a style, it sets the selcted style and keeps the Georgia font. That's what I want.

But if I select one word and then use the style combo to set a style, it sets the style but does not keep the Georgia font, it keeps using the Arial font. I want it to keep the Georgia font.

Is there a way to do that? I've tried a lot of things today and can't seem to get around that behavior. It does it in the ActionTest demo as well.

Thanks Sergy

Stan
Sergey Tkachenko
Site Admin
Posts: 18029
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Setting a Style

Post by Sergey Tkachenko »

This is by design,

Your text has font "Georgia" applied on top of properties defined by its styletemplate.

When you apply a styletemplate, the results depend on the selection. If the selection contains multiple paragraphs, the styletemplate is applied only to paragraph properties. Text properties that were set on top of styletemplate are not reset.
If the selection is inside a single paragraph, a styletemplate is applied to text properties. If this is "Normal" styletemplate, text properties are simply reset.

(The explanation above are simpliefied, because results depend on the styletemplate kind (paragraph style, text style, or text & paragraph style), with some special processing for "Normal" styletemplate.)

The best solution is style modification. If you want the default font "Georgia", specify it in the "Normal" styletemplate. In ActionTest demo, use the menu "Format | Styles", select "Normal (standard)", click the link "Edit" in the font section, and select "Georgia".
standay
Posts: 331
Joined: Fri Jun 18, 2021 3:07 pm

Re: Setting a Style

Post by standay »

Sergey Tkachenko wrote: Wed Jan 28, 2026 9:49 am The best solution is style modification. If you want the default font "Georgia", specify it in the "Normal" styletemplate. In ActionTest demo, use the menu "Format | Styles", select "Normal (standard)", click the link "Edit" in the font section, and select "Georgia".
OK, is there a way to set the Normal style font name from code? I tried and couldn't do it. I also tried assigning the font name and valid properties at design time but it apparently doesn't stay that way once the app is running. If we can't change it from code that's OK, just wanted to be sure I'm not missiing something.

Stan
Post Reply