Page 1 of 1

Removing pagebreaks

Posted: Wed Dec 22, 2010 8:42 pm
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;

Posted: Wed Dec 22, 2010 9:29 pm
by Sergey Tkachenko
How did you add a page break in a table?

Posted: Thu Dec 23, 2010 4:50 pm
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.

Posted: Thu Dec 23, 2010 6:07 pm
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);

Posted: Thu Dec 23, 2010 9:41 pm
by dc3_dcfl
Thank You very much, works perfectly.

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