Page 1 of 1
Autosize all table columns
Posted: Mon Sep 21, 2009 3:10 am
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?
Autosize all table columns
Posted: Tue Sep 22, 2009 12:27 am
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.
Autosize all table columns
Posted: Tue Sep 22, 2009 2:45 am
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?
Autosize all table columns
Posted: Tue Sep 22, 2009 6:57 am
by Andrew
Hello Mike,
Now we are working on the Table component. It will suit your needs.
Thank you.
Autosize all table columns
Posted: Tue Sep 22, 2009 9:56 pm
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.
Autosize all table columns
Posted: Wed Sep 23, 2009 7:23 am
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.