Page 1 of 1

How can I change soft returns to hard returns

Posted: Tue Aug 12, 2008 2:33 pm
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;

Posted: Wed Aug 13, 2008 6:31 pm
by Sergey Tkachenko
Instead of assigning item.SameAsPrev = True, assign item.BR = False.
This operation cannot be undone.

Posted: Wed Aug 13, 2008 6:32 pm
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.

Re: How can I change soft returns to hard returns

Posted: Wed Aug 13, 2008 7:24 pm
by j&b
Thanks.