I'm working on a doing some quick format buttons for users and when I use ApplyParaStyleConversion from a demo
Specifically: RichViewEdit.ApplyParaStyleConversion(PARA_SPACE_DEFAULT); Note: GApplyStyle is set to rvs style before calling ApplyParaStyleCovnersion.
See the code below. Also see the attachment. I get a red border and multiline spacing, plus paragraph alignment, etc. when I'm just wanting to change spacing before and after the paragraph. Is it the combination of Actions and this?
Code: Select all
procedure TMainForm.rveParaStyleConversion(Sender: TCustomRichViewEdit; rvstyle: TRVStyle;
StyleNo, UserData: Integer; AppliedToText: Boolean; var NewStyleNo: Integer);
var
ParaInfo: TParaInfo;
begin
ParaInfo := TParaInfo.Create(nil);
try
ParaInfo.Assign(GApplyStyle.ParaStyles[StyleNo]);
case UserData of
PARA_ALIGNMENT:
ParaInfo.Alignment := GApplyStyle.ParaStyles[StyleNo].Alignment;
PARA_INDENTINC:
begin
ParaInfo.LeftIndent := ParaInfo.LeftIndent + 20;
if ParaInfo.LeftIndent > 200 then
ParaInfo.LeftIndent := 200;
end;
PARA_INDENTDEC:
begin
ParaInfo.LeftIndent := ParaInfo.LeftIndent - 20;
if ParaInfo.LeftIndent < 0 then
ParaInfo.LeftIndent := 0;
end;
PARA_COLOR: ParaInfo.Background.Color := PParaColor;
PARA_LINESPACE: ParaInfo.LineSpacing := PParaLineSpaceInt;
PARA_SPACE_DEFAULT:
begin
ParaInfo.SpaceBefore:=0;
ParaInfo.SpaceAfter:= 6;
end;
// add your code here....
end;
NewStyleNo := GApplyStyle.FindParaStyle(ParaInfo);
finally
ParaInfo.Free;
end;
end;