You are not logged in.
Pages: 1
Setting LineSpacing doesn't change the line spacing within the header or footer. In a header using Tahoma 18, the spacing is too much for the style we want. I need the lines to be perfectly continuous with minimal spacing.
// Encabezado
Reporte.Font.Size := 18;
Reporte.Font.Style := [TFontStyle.fsBold];
Reporte.AddTextToHeader('Header line 1');
Reporte.AddTextToHeader('Header line 2');
Reporte.Font.Size := 0;
Reporte.AddLineToHeader(false);Is there any way to design a header more specifically, for example, adding vertical text, text and graphics in specific positions, etc.?
Last edited by Sapiem (2026-02-02 04:26:57)
Offline
As far as I could see the Header/Footer in mormot.ui.report is just printed as is, separate lines with no special layout. You can't even position text.
I had some specific requirements of other parts of the "report" mechanisme... so I took the whole TGdiPages and stripped out everything I didn't need (which was a lot). Ended up with just under 700 lines of code. So that might be the way to go if you need something special from Header and Footer. Or try to inherit TGdiPages and change the things you need (but I'm not sure how far you can go with that). You could also just generate the headers and footers yourself.
Offline
Before modifying the code, I checked whether there were non‑public variants available. For example, OnStartPageHeader might serve as a way to customize the Header. However, I cannot find any public documentation describing how to handle the Header group from that event
Offline
See the OnStartPageHeader and OnEndPageHeader event handlers.
The Sender is the current TGDIPages instance.You can easily add a bitmap to every header using one of those events.
Offline
Where can I found any example o documentation? In mormot.ui.report only we can find:
/// Event triggered when each new header is about to be drawn
property OnStartPageHeader: TNotifyEvent
read fStartPageHeader write fStartPageHeader;
//
//
//
procedure TGdiPages.DoHeader;
begin
fHeaderDone := true;
if (fHeaderLines.Count = 0) then
exit;
SaveLayout;
fInHeaderOrFooter := true;
try
if Assigned(fStartPageHeader) then
fStartPageHeader(self);
Font.Color := clBlack;
DoHeaderFooterInternal(fHeaderLines);
if Assigned(fEndPageHeader) then
fEndPageHeader(self);
GetLineHeight;
inc(fCurrentYPos, fLineHeight shr 2); // add a small header gap
fHeaderHeight := fCurrentYPos - fPageMarginsPx.Top;
finally
fInHeaderOrFooter := false;
RestoreSavedLayout;
end;
end;Offline
I can't find any documentation or complete example. So you just have to use it.
Like this:
You have to set OnStartPageHeader and OnEndPageHeader event handlers of the TGDIPages instance with your own methods.
procedure MyReportHeader(Sender: TObject); var Report: TGdiPages; begin Report := Sender as TGdiPages; Report.DrawBMP(....); end; ...... with TGdiPages.Create(self) do try OnStartPageHeader := MyReportHeader; ....
Hope it helps.
Offline
Doesn't trigger the Notification, doesn't call MyReportHeader
Edit: Yes, it trigger the event after draw anything to header
Last edited by Sapiem (2026-02-02 21:30:36)
Offline
Did you set OnStartPageHeader := MyReportHeader ??
It should trigger when doing the header.
I do see the line
if (fHeaderLines.Count = 0) then exit;
So it will only trigger if you have at least added one line the usual way (it may be just a line with one space).
(This might be considered a 'bug' because it should also trigger when you didn't add a line via add header.)
Offline
Did you set OnStartPageHeader := MyReportHeader ??
It should trigger when doing the header.I do see the line
if (fHeaderLines.Count = 0) then exit;
So it will only trigger if you have at least added one line the usual way (it may be just a line with one space).(This might be considered a 'bug' because it should also trigger when you didn't add a line via add header.)
Exactly that's it
Offline
Pages: 1