How many pageBreaks in memo ?

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

How many pageBreaks in memo ?

Post by j&b »

Hello,
I want to know how much/many PageBreaks in TDBRichViewEdit (memo).


The following procedure always shows j = 0.

What's wrong ? ... =rvsBreak ?


procedure TForm1.btnTest1Click(Sender: TObject);
var i,j: integer;
begin
j:= 0;
for i := 0 to Memo.ItemCount-1 do
if Memo.GetItemStyle(i)=rvsBreak then inc(j);

ShowMessage('Es liegen '+intToStr(j)+' Seitenumbrüche vor');
end;
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: How many pageBreaks in memo ?

Post by j&b »

I think I have found a solution:


procedure TForm1.btnTest1Click(Sender: TObject);
var i,j: Integer;
begin
j:= 0;
for i:= 0 to memo.ItemCount-1 do
if memo.PageBreaksBeforeItems then inc(j);

if j>0 then ShowMessage('Es liegen '+intToStr(j)+' Seitenumbrüche vor');
end;
Sergey Tkachenko
Site Admin
Posts: 17561
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This code is correct. Please note that it counts a number of page breaks added explicitly by "Insert Page Break" command, not a real number of pages.
You may also add a number of explicit page breaks in all tables in memo: table.Rows[r].PageBreakBefore
Post Reply