Page 1 of 1

set BottomMargin with Footer Height

Posted: Sat Jan 31, 2026 8:29 am
by DanielM
srve.PageProperty.BottomMargin :=

Hi,

How can I set srve.PageProperty.BottomMargin with footer height?

procedure ApplyFooter(Vars: array of rVarS);
cousin
i, j: Integer;
Tables: TRVTableItemInfo;
CenteredParaNo, TabbedParaNo, NormalTextNo, NormalTextNo2: Integer;
// BoldTextNo, NormalParaNo, ColoredParaNo, RightParaNo, BigBoldTextNo: Integer;
RVStyle: TRVStyle;
Cell: TRVTableCellData;
RVData: TCustomRVData;
PItem: TRVPageNumberItemInfo;
sText: string;
begin
try
for j := 1 to 2 do
begin
if j = 1 then
begin
srve.SubDocuments[srvhftFirstPageFooter].Clear;
RVData := srve.SubDocuments[srvhftFirstPageFooter].GetRVData;
RVStyle := srve.SubDocuments[srvhftFirstPageFooter].GetRVStyle;
end
else
begin
srve.SubDocuments[srvhftNormalFooter].Clear;
RVData := srve.SubDocuments[srvhftNormalFooter].GetRVData;
RVStyle := srve.SubDocuments[srvhftNormalFooter].GetRVStyle; // RVData.GetRVStyle;
end;
// creating text and paragraph styles
// NormalParaNo := GetParaStyle(RVStyle, rvaLeft);
// RightParaNo := GetParaStyle(RVStyle, rvaRight);
// ColoredParaNo := GetParaStyle(RVStyle, rvaLeft, RVStyle.PixelsToUnits(0, 1), 0, $006CD9, clBlack);
CenteredParaNo := GetParaStyle(RVStyle, rvaCenter);
TabbedParaNo := GetParaStyle(RVStyle, rvaRight);
NormalTextNo := GetTextStyle(RVStyle, 8, [], clBlack, 'Georgia');
NormalTextNo2 := NormalTextNo;
if (j = 1) then
begin
RVData.AddTextNLW('', NormalTextNo, TabbedParaNo, TabbedParaNo);
end;

// making table 1 (logo | info)
Tables := TRVTableItemInfo.CreateEx(1, 2, RVData);
Table.ParaNo := CenteredParaNo;
Table.BorderWidth := 0;
Table.Color := clNone;
Table.BestWidth := -100;
Table.Cells[0, 0].BestWidth := -60;
Table.Cells[0, 1].BestWidth := -40;

Cell := Table.Cells[0, 1];
Cell.Clear;
Cell.VAlign := rvcTop;

Cell.AddTextNLW('Bank of Enterprising People', NormalTextNo, TabbedParaNo, TabbedParaNo);

Cell := Table.Cells[0, 0];
Cell.Clear;

TabbedParaNo := GetParaStyle(RVStyle, rvaLeft, 0, RVStyle.PixelsToUnits(0, 100));
for i := Low(Vars) to High(Vars) do
begin
sText := i.ToString+') '+ Vars.Value;
NormalTextNo := GetTextStyle(RVStyle, 8, GetStyle(sText), clBlack, 'Georgia');
Cell.AddTextNLW(sText, NormalTextNo, TabbedParaNo, TabbedParaNo);
end;
RVData.AddItem('', Table);


PItem := TRVPageNumberItemInfo.Create(RVData);
PItem.NumberType := rvpntDecimal;
PItem.ParaNo := CenteredParaNo;
PItem.TextStyleNo := NormalTextNo2;
RVData.AddItem('', PItem);

end;
serve.PageProperty.FooterY := 0.8;

srve.PageProperty.BottomMargin :=srve.RVFooter.Height ; //3.5;

serve.PageProperty.UpdatePageSize;

serve.RVFooter.Change;
if serve.RichViewEdit.Modified then
serve.RichViewEdit.Format;

Re: set BottomMargin with Footer Height

Posted: Sat Jan 31, 2026 1:53 pm
by Sergey Tkachenko
Why do you want to do it?
ScaleRichView displays bottom margin large enough to include footer, even if PageProperty.BottomMargin is small (but the limit of 1/3 page height).
I.e.,

Code: Select all

visible_bottom_margin = max(
  PageProperty.BottomMargin, 
  min(PageProperty.FooterY + footer_height, PageProperty.PageHeight / 3)
 );

Re: set BottomMargin with Footer Height

Posted: Sat Jan 31, 2026 2:07 pm
by DanielM
I use ScaleRichView as the non-visual component, if I manually set PageProperty.BottomMargin:= X Value, it displays correctly that X is set to a correct value, I approximate because I don't know what the Footer height is (work ok if I have 3..4 rows).

You said I have to use the formula: visible_bottom_margin = max(
PageProperty.BottomMargin,
min(PageProperty.FooterY + footer_height, PageProperty.PageHeight / 3)
);

the question is how do I find out what the value of footer_height is, no matter how many rows I add (ex: a number of 10 lines of text with a certain font/size set)