(it implements it by adding an empty line and up to two page breaks)
Code: Select all
procedure InsertPage(rve: TCustomRichViewEdit);
var
AtStart, AtEnd: Boolean;
begin
rve := rve.TopLevelEditor;
AtStart :=
((rve.CurItemNo = 0) or
((rve.CurItemNo = 1) and (rve.GetItemStyle(0) = rvsListMarker))) and
(rve.OffsetInCurItem <= rve.GetOffsBeforeItem(rve.CurItemNo));
AtEnd := (rve.CurItemNo = rve.ItemCount - 1) and
(rve.OffsetInCurItem >= rve.GetOffsAfterItem(rve.CurItemNo));
rve.BeginUndoGroup(rvutInsertPageBreak);
rve.SetUndoGroupMode(True);
try
rve.InsertText(#13);
rve.InsertPageBreak;
if not AtEnd then
begin
SendMessage(rve.Handle, WM_KEYDOWN, VK_LEFT, 0);
if not AtStart then
rve.InsertPageBreak;
end;
finally
rve.SetUndoGroupMode(False);
end;
end;
Code: Select all
procedure TForm3.ToolButton63Click(Sender: TObject);
begin
SRichViewEdit1.StartEditing(srvrveMain);
SRichViewEdit1.CanUpdate := False;
InsertPage(SRichViewEdit1.ActiveEditor);
SRichViewEdit1.CanUpdate := True;
end;