Autosize all table columns

Stimulsoft Reports.NET discussion
Post Reply
mike_berriman
Posts: 4
Joined: Wed Sep 09, 2009 8:27 pm
Location: Western Australia

Autosize all table columns

Post by mike_berriman »


I'm creating a table in code, where the data in the report is not known until runtime. I know you can autosize each column (cell) to fit its contents, but when you do this the cells overprint each other for long strings. What I'd like to be able to do is "autosize" all the columns to best fit the data. I don't mind long column values being word wrapped and multi-line, but some relative sizing would be good - at the moment I'm just taking the page width and dividing it by the number of columns - but that is less than ideal.

Obviously, the cells in the header and footer bands would have to be autosized to match the data band as well.

Does anyone know how to do this?
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Autosize all table columns

Post by Jan »

Hello Mike,

Try to use DockStyle property of component. Set this property to Left for all components which placed on Databand. Set Fill to last component.

Thank you.
mike_berriman
Posts: 4
Joined: Wed Sep 09, 2009 8:27 pm
Location: Western Australia

Autosize all table columns

Post by mike_berriman »

Hi Jan,

While that gives an interesting effect, it's not quite what I was looking for. The steps you mentioned do what I want for each row, but I'd like to be able to do it for the table as a whole. So basically, go through all the rows in the table, and find the size for each column that best fits the data in that column. Do that for all columns in the table, such that the table takes up 100% of the page width.

It's quite possible that some columns will still be wrapped. I've written something myself that does a reasonable job, as it appears there's no way to do this with the Stimulsoft reports. Basically, it finds the longest string in each column, and then works out a percentage of the total number of characters each column should be, and manually resizes the columns to these sizes.

Any other options on how to get the Stimulsoft report to do this?
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Autosize all table columns

Post by Andrew »

Hello Mike,

Now we are working on the Table component. It will suit your needs.

Thank you.
mike_berriman
Posts: 4
Joined: Wed Sep 09, 2009 8:27 pm
Location: Western Australia

Autosize all table columns

Post by mike_berriman »

Hi Andrew,

Ok - great. That answers my question :)

Can you tell me if the table component is likely i the next 3, 6 or 12 months?

Thanks.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Autosize all table columns

Post by Jan »

Hello Mike,

Table component will be available in next release - 2009.3 (December 2009). I think you can get it in prerelease builds in next 1-1.5 months.

Thank you.
Post Reply