Page 1 of 1

Want procedure to change paragraph spacing for any Trichview

Posted: Mon Sep 21, 2015 10:09 am
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!

Posted: Wed Sep 23, 2015 6:54 pm
by Sergey Tkachenko
Do you want to change spacing for the current/selected paragraph, or for all paragraphs?

Posted: Mon Sep 28, 2015 7:38 am
by shoebuddy
I want to change it for all paragraphs--Thanks!

Posted: Mon Sep 28, 2015 7:39 am
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.

Posted: Mon Sep 28, 2015 8:32 am
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;

Posted: Tue Sep 29, 2015 7:05 am
by shoebuddy
Thanks so much! :D