Is dynamic columns possible?


I don't know how many the columns exactly is util the user submits a request,how can I come true a dynamic columns in a jasperreport template?

Thank you very much!
Post edited by: cuiweibing, at: 2006/08/03 05:21
cuiweibing's picture
Joined: Jul 25 2006 - 5:50pm
Last seen: 17 years 2 months ago

6 Answers:


You could build or modify the report template dynamically using the API, just like shown in the /demo/samples/noxmldesign sample that comes with the project distribution.
If you do that, you would also need to compile it on-the-fly after building or modifyinf the JasperDesign object.

I hope this helps.
teodord's picture
Joined: Jun 30 2006 - 9:00am
Last seen: 2 hours 33 min ago
Thank you very much, Teodor!

Post edited by: cuiweibing, at: 2006/08/07 02:15
cuiweibing's picture
Joined: Jul 25 2006 - 5:50pm
Last seen: 17 years 2 months ago

thanks, I have actually used the api to modify my jasperDesign object and recompile my report.  The question I have is, how to I wrap columns.  At times the columns I have, created dynamically from user input, exceeds the width of the page.  How to I create new pages at the end of the report for the remaining columns.  Crosstabs do something similiar when the columns exceed the width of the page, it prints the remaining columns at the end of the report on new pages.  How could I achieve something similiar?



broschb's picture
Joined: Dec 4 2006 - 4:42am
Last seen: 6 years 1 month ago

Hi everyone,

I want just to ask you about the dynamic columns, if there is any improvment about creating dynamic reports, or I should do it the way it is replied earlier?

The problem is that my report is too big and it will be very hard to implement it all using the api. Is there any way to create it with iReport and then editing some how the text fields or static texts and their position or even remove some of them i it si needed, for example?

I will be very pleased if you can answer me soon!

Thank you in advance!

vici4a's picture
Joined: May 31 2007 - 6:25pm
Last seen: 16 years 4 months ago
There is another thread that also has a requirement to show/hide columns based on user input. Can you accomplish what you want by dynamicallly building a parameter list of subreports that is passed to the Master? Each column in your report would need to be a separate subreport. How many columns do you want to display in your report?
donclary's picture
Joined: Sep 9 2007 - 7:55am
Last seen: 16 years 3 weeks ago

Hello, please I need change the design(.jrml) in execution time but not working,I dont no why...

  please ,any body can help me Lemay

my code : $JasperDesign = new Java (''); > $JRDesignQuery = new Java (''); > $JRXmlLoader = new Java ('net.sf.jasperreports.engine.xml.JRXmlLoader'); > > $JasperDesign = $JRXmlLoader->load('C:\Archivos de programa\Apache Group\Apache2\htdocs\web\Copia de reporte3.jrxml'); > > $query = "Select nombre,Ci,telef from empleados Order by nombre"; > > $JRDesignQuery->setText($query); > $JasperDesign->setQuery($JRDesignQuery); > > > $JasperDesign->removeField('nombre'); //I want delete the field 'nombre' in my report design > > $compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager"); > > > $report = $compileManager->compileReport($JasperDesign);

Post Edited by michel Rodriguez at 03/17/09 03:56

Post Edited by michel Rodriguez at 03/17/09 03:57
michelr's picture
Joined: Mar 16 2009 - 7:41pm
Last seen: 14 years 6 months ago