pnvswamy Posted November 6, 2008 Share Posted November 6, 2008 I want to generate the Reports with dynamic columns.I dont know how to use......Please help me some guide lines. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 13, 2008 Share Posted November 13, 2008 Hi,If you have dynamic columns, it means your report template actually changes at runtime.You can create dynamic report templates at runtime by using the JasperReports API directly like shown in the /demo/samples/noxmldesign sample provided with the project distribution file.Depending on the actual structure of the document, maybe a crosstab could also help.In the future we'll probably have a true table component in JasperReports, but for now you have to try the above mentioned solutions. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
vembu Posted July 21, 2009 Share Posted July 21, 2009 Hi Teodor, Thanks for guiding/supporting us.is there any code/sample developed for table component. if so can u post the link. As well u have mentioned: /demo/samples/noxmldesign for dynamic column header & field.how can we say it as dynamic since the fields are hard coded. Is it possible for us to fetch the fields as array and by hadling the loop is it possible to form the column header & detail band with that array dynamically.if so can you please post me that code sample Code: i am expect something like getting field count dynamically & form the column header , detail dynamically using the loop,like the one below for column header:for (i=0; i<count(total); i++){field.setName(array[i]); field.setValueClass(java.lang.String.class); jasperDesign.addField(field);} for detail,var leftPosition = 0;for (i=0; i<count(total); i++){textField = new JRDesignTextField(); textField.setX(leftPosition); textField.setY(4); textField.setWidth(50); textField.setHeight(15); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_RIGHT); textField.setStyle(normalStyle); expression = new JRDesignExpression(); expression.setValueClass(java.lang.String.class); expression.setText("$F{array}"); textField.setExpression(expression); band.addElement(textField); leftPosition = leftPosition+100;}Post Edited by vembu at 21/07/2009 12:24 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 21, 2009 Share Posted August 21, 2009 Hi, You can use loops to iterate through fields and all the stuff you want to do. You just have to try it, without asking for prior confirmation from us. Good luck!Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now