Page 1 of 1

How many pageBreaks in memo ?

Posted: Sat Apr 18, 2015 2:31 pm
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;

Re: How many pageBreaks in memo ?

Posted: Sat Apr 18, 2015 5:04 pm
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;

Posted: Sun Apr 19, 2015 9:15 am
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