Jump to content
We've recently updated our Privacy Statement, available here ×

Variable number of Columns


2005 IR Help

Recommended Posts

By: huntinghorse - huntinghorse

Variable number of Columns

2004-11-19 06:04

Hello,

 

i need some help with japser reports. I am using iReport 0.4 and i wish to design a report file which I can fill with a table I do not know much about.

 

I want to have a flexible number of columnsfrom one to for example 20. This number can change each time I generate the report. Is it possible to make the unused columns invisible?

Additionaly, is it possible to place more columns right beside the flexible table. Else there would be some space, because of the unsed columns.

 

I know that this is not a trivial problem and that it is not that easy to solve.

 

I searched the forum, but I did not found much information on this.

 

Thank You.....

 

 

 

 

By: ben - bension

RE: Variable number of Columns

2004-11-20 03:54

The only way I found to do this was programatically.

eg

 

...

JasperDesign design = blah JRXmlLoader.load("base_report.jrxml");

 

JRDesignBand band = new JRDesignBand();

band.setHeight(20);

JRDesignTextField textField = new JRDesignTextField();

textField.setX(0);

textField.setY(4);

textField.setWidth(50);

textField.setHeight(15);

textField.setTextAlignment(JRTextElement.TEXT_ALIGN_RIGHT);

JRDesignExpression expression = new JRDesignExpression();

expression.setValueClass(java.lang.String.class);

expression.setText("$F{item}");

textField.setExpression(expression);

band.addElement(textField);

//etc to keep adding fields

...

 

hth

Ben

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...