[Português]
Como alterar as duas opções marcadas a baixo em tempo de execução?
Obrigado!
[English]
Hi Sergey,
How to change the two options marked below at run time?
Thanks!
Change line spacing in Runtime
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Change line spacing in Runtime
Do you want to change it for the selected paragraphs?
If you use RichViewActions, the simplest way is using TrvActionParagraph without a dialog.
For example, to apply double line spacing:
Without RichViewActions, use ApplyParaStyleConversion method + OnParaStyleConversion event, like it is shown in TRichView demo Editors\Editor2\
You need to return the index of paragraph style having the proper values of LineSpacing and LineSpacingType properties.
If you use RichViewActions, the simplest way is using TrvActionParagraph without a dialog.
For example, to apply double line spacing:
Code: Select all
rvActionParagraph1.UserInterface := False;
rvActionParagraph1.LineSpacingType := rvlsPercent;
rvActionParagraph1.LineSpacing := 200;
rvActionParagraph1.ValidProperties := [rvpimLineSpacing];
rvActionParagraph1.ExecuteTarget(RichViewEdit1);
rvActionParagraph1.UserInterface := True;
Without RichViewActions, use ApplyParaStyleConversion method + OnParaStyleConversion event, like it is shown in TRichView demo Editors\Editor2\
You need to return the index of paragraph style having the proper values of LineSpacing and LineSpacingType properties.
Re: Change line spacing in Runtime
[Portugues]
Funcionou apenas para o parágrafo selecionado.
Como faço para alterar o todo o texto?
[English]
It only worked for the selected paragraph.
How do I change all the text?
Funcionou apenas para o parágrafo selecionado.
Como faço para alterar o todo o texto?
[English]
It only worked for the selected paragraph.
How do I change all the text?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Change line spacing in Runtime
If you want to make it as an editing operation, select the whole text (call RichViewEdit1.SelectAll), then call the code above.
If you want to make it as a fast not undoable operation, call:
(assuming that RichViewEdit1.Style = RVStyle1)
This code works for TRichView as well, just remove the call of ClearUndo. The call of DeleteUnusedStyles is optional.
If you need to create a new document with specific line spacing, just create items in RVStyle1.ParaStyles with the proper properties, and use their indexes when calling Add methods (like AddNL or AddPicture).
If you want to make it as a fast not undoable operation, call:
(assuming that RichViewEdit1.Style = RVStyle1)
Code: Select all
RichViewEdit1.ClearUndo;
RichViewEdit1.DeleteUnusedStyles(True, True, True);
for i := 0 to RVStyle1.ParaStyles.Count - 1 do
begin
RVStyle1.ParaStyles[i]LineSpacingType := rvlsPercent;
RVStyle1.ParaStyles[i]LineSpacing := 200;
end;
RichViewEdit1.Format;
If you need to create a new document with specific line spacing, just create items in RVStyle1.ParaStyles with the proper properties, and use their indexes when calling Add methods (like AddNL or AddPicture).