Removing pagebreaks

General TRichView support forum. Please post your questions here
Post Reply
dc3_dcfl
Posts: 33
Joined: Sat Jan 30, 2010 12:45 am

Removing pagebreaks

Post by dc3_dcfl »

I am using this to remove page breaks from my DBRVE, but it does not remove them from tables. How can I modify this code to also remove page breaks in tables.

Code: Select all

for I := 0 to DBRVE.ItemCount-1 do
begin
   if DBRVE.PageBreaksBeforeItems[I] then
   begin
      DBRVE.SetSelectionBounds(I, DBRVE.GetOffsBeforeItem(I), I, DBRVE.GetOffsBeforeItem(I));
      DBRVE.RemoveCurrentPageBreak;
   end;
end;
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

How did you add a page break in a table?
dc3_dcfl
Posts: 33
Joined: Sat Jan 30, 2010 12:45 am

Post by dc3_dcfl »

All of my documents are created in Word and then imported using RVActions. I cannot tell you if the page breaks exist in the Word doc, I'll have to check, but they are there after the import process in the RVE.

I have to manually go to each cell that has a page break and manually delete them. I was hoping I could automate the process somehow.
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

try

Code: Select all

procedure RemoveAllPageBreaks(RVData: TCustomRVData; RVE: TCustomRichViewEdit);
var i, r, c: Integer;
     Table: TRVTableItemInfo;
begin
  for i := 0 to RVData.ItemCount-1 do begin
    if RVData.PageBreaksBeforeItems[I] then begin 
      RVData := RVData.Edit;
      TCustomRVFormattedData(RVData).SetSelectionBounds(i, RVData.GetOffsBeforeItem(i), i, RVData.GetOffsBeforeItem(i)); 
      RVE.TopLevelEditor.RemoveCurrentPageBreak; 
   end;
   if RVData.GetItemStyle(i)=rvsTable then begin
     Table := TRVTableItemInfo(RVData.GetItem(i));
      for r := 0 to Table.RowCount-1 do
        for c := 0 to Table.ColCount-1 do
          if Table.Cells[r,c]<>nil then
            RemoveAllPageBreaks(Table.Cells[r,c].GetRVData, RVE);
    end;
  end;
end;

// call
RemoveAllPageBreaks(DBRVE.RVData, DBRVE);
dc3_dcfl
Posts: 33
Joined: Sat Jan 30, 2010 12:45 am

Post by dc3_dcfl »

Thank You very much, works perfectly.

Hope you have a very Merry Christmas and New Years!!
Post Reply