Making report from code
By A.Bouchez on 2010, Wednesday June 30, 19:05 - Synopse PDF engine - Permalink
Did you notice the SQLite3Pages units?
It's a reporting unit included in our SQlite3/mORMot framework, but it
can be used standalone...
Just right click on the report preview to see options.
procedure TForm1.btn1Click(Sender: TObject);
var i: integer;
begin
with TGDIPages.Create(self) do
try
// the title of the report
Caption := self.Caption;
// now we add some content to the report
BeginDoc;
// header and footer
AddTextToHeader(paramstr(0));
SaveLayout;
Font.Style := [fsItalic];
TextAlign := taRight;
AddTextToFooterAt('http://synopse.info',RightMarginPos);
RestoreSavedLayout;
AddTextToFooter(DateTimeToStr(Now));
// main content (automaticaly split on next pages)
NewHalfLine;
DrawTitle(edt1.Text,true);
for i := 1 to 10 do
DrawText('This is some text '+IntToStr(i));
NewLine;
AddColumns([10,20,50]);
AddColumnHeaders(['#','Two','Three'],true,true);
for i := 1 to 100 do
DrawTextAcrossCols([IntToStr(i),'Column '+IntToStr(i),'Some text here']);
NewLine;
DrawTitle('This is your text:');
DrawText(mmo1.Text);
EndDoc;
// this method will show a preview form, and allow basic actions
// by using the right click menu
ShowPreviewForm;
finally
Free;
end;
end;
It features the most exciting possibilities of SynPdf, i.e. fast and exact
creation, TMetaFile handling, UniScribe handling
(e.g. for Arabic), optional PDF/A-1 generation, bookmarks, outline and links,
document information, bitmap image reuse... See here a Report from Code - PDF
export generated by TGdiPages.
There is a preview window at hand.
Download link, and discussion in our forum.