I don't understand what I'm doing wrong. I have set my RVStyle single item to have the font Times New Roman size 12. But every time I start a new note: the style is calibri 11?????
How to I initiate the editor so every note starts out Times New Roman 12?
Style woes
-
- Site Admin
- Posts: 17561
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17561
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Actually, in all cases, the default font is defined in RVStyle.TextStyles[0].
When using StyleTemplates, the proper way for implementing New command includes resetting properties of RVStyle.TextStyles[0] to values defined in "Normal" style template. TrvActionNew does it automatically. Without RichViewActions, implementation is shown in Demos\DelphiUnicode\Editors\StyleTemplates\
But even if you do not use StyleTemplates, it's normally not enough to define properties of RVStyle.TextStyles[0] one time. Your editor can load RVF documents (from DB or file), and collections of styles will be replaced.
For TDBRichViewEdit, you can set default text style in OnNewDocument event:
When using StyleTemplates, the proper way for implementing New command includes resetting properties of RVStyle.TextStyles[0] to values defined in "Normal" style template. TrvActionNew does it automatically. Without RichViewActions, implementation is shown in Demos\DelphiUnicode\Editors\StyleTemplates\
But even if you do not use StyleTemplates, it's normally not enough to define properties of RVStyle.TextStyles[0] one time. Your editor can load RVF documents (from DB or file), and collections of styles will be replaced.
For TDBRichViewEdit, you can set default text style in OnNewDocument event:
Code: Select all
procedure TForm1.DBRichViewEdit1NewDocument(Sender: TObject);
var RVStyle: TRVStyle;
begin
RVStyle := (Sender as TCustomRichView).Style;
RVStyle.TextStyles.Clear;
RVStyle.ParaStyles.Clear;
RVStyle.ListStyles.Clear;
with RVStyle.TextStyles.Add do
begin
FontName := 'Times New Roman';
Size := 12;
end;
RVStyle.ParaStyles.Add;
end;