Removing Page break

General TRichView support forum. Please post your questions here
Post Reply
ChristopheA
Posts: 7
Joined: Mon Jan 22, 2007 5:25 pm

Removing Page break

Post 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)
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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;
ChristopheA
Posts: 7
Joined: Mon Jan 22, 2007 5:25 pm

Post by ChristopheA »

Works fine, thanks :D
Post Reply