Page 1 of 1

Removing Page break

Posted: Tue Apr 17, 2007 1:36 pm
by ChristopheA
Hi there,

I tried using to remove Page break:

Code: Select all

While reText.SearchText(#12, SearchOptions) do
        reText.InsertText('');
but it does not work, any idea?

(reText is a TRichViewEdit)

Posted: Tue Apr 17, 2007 6:15 pm
by Sergey Tkachenko
Page break is not stored as character, so it cannot be found using SearchText. Page break is an item property.

If you need to remove all page breaks, and it should not be an editing operation, the code is:

Code: Select all

for i := 0 to reText.ItemCount-1 do
  reText.PageBreaksBeforeItems[i] := False;
If it must be an editing operation (that can be undone by users), the code is:

Code: Select all

for i := 0 to reText.ItemCount-1 do
  if reText.PageBreaksBeforeItems[i] then begin
    reText.SetSelectionBounds(i, reText.GetOffsBeforeItem(i),
      i, reText.GetOffsBeforeItem(i));
    reText.RemoveCurrentPageBreak;
  end;

Posted: Wed Apr 18, 2007 6:43 am
by ChristopheA
Works fine, thanks :D