Want procedure to change paragraph spacing for any Trichview

General TRichView support forum. Please post your questions here
Post Reply
shoebuddy
Posts: 33
Joined: Thu Sep 10, 2015 5:09 pm

Want procedure to change paragraph spacing for any Trichview

Post by shoebuddy »

I want to make a procedure that will change the line spacing for any TDBRichViewEdit I send it.

I can call actions but some of my editors are on different forms. Is there some other way to do this?

Thanks!
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you want to change spacing for the current/selected paragraph, or for all paragraphs?
shoebuddy
Posts: 33
Joined: Thu Sep 10, 2015 5:09 pm

Post by shoebuddy »

I want to change it for all paragraphs--Thanks!
shoebuddy
Posts: 33
Joined: Thu Sep 10, 2015 5:09 pm

Post by shoebuddy »

Am also trying to come up with a fast way to change Font and size for all paragraphs in all notes (hundreds) in a database.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

procedure ChangeDoc(rv: TCustomRichView);
var i: Integer;
begin
  for i := 0 to rv.Style.ParaStyles.Count-1 do 
  begin
    rv.Style.ParaStyles[i].LineSpacingType := rvlsPercent;
    rv.Style.ParaStyles[i].LineSpacing := 100; 
  end;
  for i := 0 to rv.Style.TextStyles.Count-1 do 
  begin
    rv.Style.TextStyles[i].FontName := 'Tahoma';
    rv.Style.TextStyles[i].Size := 10;
  end;
end;

...
Table1.First;
while not Table1.EOF do
begin
  if DBRichViewEdit1.CanChange then
  begin
    ChangeDoc(RichViewEdit1);
    RichViewEdit1.Change;
    Table1.Post;
  end;
  Table1.Next;
end;
shoebuddy
Posts: 33
Joined: Thu Sep 10, 2015 5:09 pm

Post by shoebuddy »

Thanks so much! :D
Post Reply