[Demo] Shared StyleTemplates

Demos, code samples. Only questions related to the existing topics are allowed here.
Post Reply
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

[Demo] Shared StyleTemplates

Post by Sergey Tkachenko »

1) This demo uses FireDAC and InterBase table:
http://www.trichview.com/support/files/ ... dac_ib.zip
2) This demo uses BDE:
http://www.trichview.com/support/files/ ... mo-bde.zip

TRichView 17.3 or newer is required.

These demos show how to use the rvfoSaveStyleTemplatesOnlyNames option.

Basically, these are ActionTest demos, but they use TDBRichViewEdit, so all file-related actions are deleted, and TDBNavigator is added.
rvfoSaveStyleTemplatesOnlyNames is included in DBRichViewEdit.RVFOptions.

In this demo, StyleTemplates are applied to all records in the table. If you change them (menu "Format | Styles"), these changes are applies to all documents in all records.

On start, the demo loads StyleTemplates:

Code: Select all

RVStyle1.StyleTemplates.LoadFromRVST(ExtractFilePath(Application.ExeName)+'DBDemo.rvst',
    RVStyle1.Units);
On exit, the demo saves StyleTemplates:

Code: Select all

  RVStyle1.StyleTemplates.SaveToRVST(ExtractFilePath(Application.ExeName)+'DBDemo.rvst',
    RVStyle1.Units);
This demo processes AfterScroll event to update the ruler:

Code: Select all

procedure TForm3.Table1AfterScroll(DataSet: TDataSet);
begin
  RVRuler1.UpdateRulerMargins;
  RichViewEdit1.CurTextStyleChange; 
  RichViewEdit1.CurParaStyleChange  
end;
To test styles, open the styles dialog (Format | Styles), click the Import button, and select one of RVST files placed in "styles" folder. Of course, you can change styles manually in this dialog, You will see that changes are applied to all documents in the database.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: [Demo] Shared StyleTemplates

Post by Sergey Tkachenko »

This video shows how this demo works:
Post Reply