Forum > General

LazReport [ CLOSED ]

(1/1)

Deepaak:
How to create LazReport programatically. My project takes different database as per user choice. If somebody can provide sample code or demo project than it will be very usefull.

GetMem:
@Deepaak

--- Quote ---How to create LazReport programatically. My project takes different database as per user choice. If somebody can provide sample code or demo project than it will be very usefull.

--- End quote ---
I'm not sure what you mean. Each LazReport has a DataSet property, which can be assigned just before the report starts like this:

--- 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";}};} ---frReport1.Dataset := frDBDataSet1;
frDBDataSet1 has a DataSet/DataSource property, you can also change that according to your needs:

--- 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";}};} ---frDBDataSet1.DataSet := SQLQuery1; The query can be linked to whatever database you like.

On the other hand it's also possible to create a report dynamically from scratch, you can find an example for FortesReport here: http://forum.lazarus.freepascal.org/index.php/topic,43151.msg301584.html#msg301584. You can do the same thing for LazReport, but building a complex report dynamically though it's not particularly hard, it's a time consuming task.


Navigation

[0] Message Index

Go to full version