How can I change soft returns to hard returns

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

How can I change soft returns to hard returns

Post by j&b »

Hello,

How can I change soft returns to hard returns ?

Sergey tells me in 2 samples how to remove returns. But I can't change his samples so that I can replace soft returns through hard returns.

procedure TForm1.RemoveWeicheReturns(RVData: TCustomRVData);
var i: Integer; //entfernt weiche Returns
rve_2: TCustomRichViewEdit;
StartNo, EndNo, a, b: Integer;
begin
rve_2 := memo.TopLevelEditor;
rve_2.GetSelectionBounds(StartNo, a, EndNo, b, True);
if StartNo<0 then begin
StartNo := rve_2.CurItemNo;
EndNo := StartNo;
end;


for i := StartNo+1 to EndNo do
if (i>0) and rve_2.IsFromNewLine(i) and (not rve_2.IsParaStart(i)) and (not rve_2.GetItem(i-1).GetBoolValue(rvbpFullWidth)) then
rve_2.GetItem(i).SameAsPrev := True;

end;


procedure TForm1.RemoveWHreturns(RVData: TCustomRVData);
var i: Integer; //entfernt weiche + harte Returns
rve_2: TCustomRichViewEdit;
StartNo, startEnd, a, b: Integer;
begin
rve_2 := memo.TopLevelEditor;
rve_2.GetSelectionBounds(StartNo, a, startEnd, b, True);
if StartNo<0 then begin
StartNo := rve_2.CurItemNo;
startEnd := StartNo;
end;


for i := startNo+1 to startEnd do
if (i>0) and RVData.IsFromNewLine(i) and (not RVData.GetItem(i).GetBoolValue(rvbpFullWidth)) and (not RVData.GetItem(i-1).GetBoolValue(rvbpFullWidth)) and ((RVData.GetItemStyle(i)<>rvsListMarker)) then RVData.GetItem(i).SameAsPrev := True

end;
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Instead of assigning item.SameAsPrev = True, assign item.BR = False.
This operation cannot be undone.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

By the way, if these line breaks appear because of RTF import and you do not need them, assign RichViewEdit.RTFReadProperties.LineBreaksAsParagraphs = True.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: How can I change soft returns to hard returns

Post by j&b »

Thanks.
Post Reply