Forum > Packages and Libraries

FPReport: Data in Base64?

(1/2) > >>

SymbolicFrank:
If I make this table:


--- Code: ---create table TestTable (ID integer, Description text, Comment text);
insert into TestTable (ID, Description, Comment) values (1, "Zomg", "Bla");
--- End code ---

and run this code:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TMainForm.ReportButtonClick(Sender: TObject);var  q: TSQLQuery;  rpt: TFPReport;  dat: TFPReportDatasetData;  p: TFPReportPage;  memo: TFPReportMemo;  title: TFPReportTitleBand;  data: TFPReportDataBand;  exporter: TFPReportExportPDF;begin  PaperManager.RegisterStandardSizes;  rpt := TFPReport.Create(nil);  rpt.Author := 'Frank';  rpt.Title := 'Test';   q := TSQLQuery.Create(nil);  q.SQLConnection := LiteConnection;  q.SQL.Text := 'select * from TestTable';  q.Open;  dat := TFPReportDatasetData.Create(nil);  dat.DataSet := q;  p := TFPReportPage.Create(rpt);  p.Orientation := poPortrait;  p.PageSize.PaperName := 'A4';  p.Margins.Left := 30;  p.Margins.Top := 20;  p.Margins.Right := 30;  p.Margins.Bottom := 20;  p.Font.Name := 'LiberationSans';  p.Data := dat;  title := TFPReportTitleBand.Create(p);  title.Layout.Height := 40;  memo := TFPReportMemo.Create(title);  memo.Layout.Left := 5;  memo.Layout.Top := 0;  memo.Layout.Width := 140;  memo.Layout.Height := 15;  memo.Text := rpt.Title;  memo.TextAlignment.Vertical := tlCenter;  memo.TextAlignment.Horizontal := taCentered;  memo.UseParentFont := False;  memo.Font.Color := TFPReportColor($000080);  memo.Font.Size := 24;  data := TFPReportDataBand.Create(p);  data.Layout.Height := 30;  data.Data:= dat;  memo := TFPReportMemo.Create(data);  memo.Layout.Left := 30;  memo.Layout.Top := 0;  memo.Layout.Width := 150;  memo.Layout.Height := 50;  memo.Text := 'ID: [ID], Description: [Description], Comment: [Comment]';   gTTFontCache.SearchPath.Add('.\fonts\');  gTTFontCache.BuildFontCache;  rpt.RunReport;  exporter := TFPReportExportPDF.Create(nil);  rpt.RenderReport(exporter);   exporter.Free;  dat.Free;  rpt.Free;  q.Free;end; 
Then this is what is printed on the report:


--- Code: ---ID: 1, Description: Wm9tZw==, Comment: Qmxh
--- End code ---

???

It looks like Base64.

I did try multiple different versions of freetype-6.ddl, as from the FAQ, but that doesn't make a difference. This is with fpc/Lazarus checked out at 2023-01-02, on Windows 10 64bit.

SymbolicFrank:
Well, I have been debugging this a bit, but it's not easy to understand. So, unless someone knows what is happening, I think LazReport is a better choice.

eldonfsr:
Wow i try some similar but i don't get work , I using lazreport, because fpreport documentation is poor and also who support  fperpot......

Thaddy:

--- Quote from: SymbolicFrank on January 30, 2023, 09:11:14 am ---Well, I have been debugging this a bit, but it's not easy to understand. So, unless someone knows what is happening, I think LazReport is a better choice.

--- End quote ---
I think not. fpreport is relatively new, much better structured and much easier to use. The two main authors are part of the core developer team. It is likely that you simply miss the set of controls that lazreport has. I strongly advise you use fpreport.

af0815:
There is a sample in Lazarus as a starting point for fpreport. And in Lazarus is a builder for fpreport and with this you can also test reports.

fpreport have some issue if you have to use more datasets (no Master-Detail) for complex reports, there is LazReport more flexible. ANd the core developer says "it is by design" to handle only one dataloop, no changes planned yet.

Edit: I have here https://github.com/afriess/fpReportSamples/tree/master/source some samples and in the branch wip_tests is a try for a converter Reports To Pascal Source. (It was a idea to make a report with the designer and later sourcecode from this report)

Navigation

[0] Message Index

[#] Next page

Go to full version