Column Width as ReadOnly

Column Width as ReadOnly

Forum member · Mar 28, 2007
I am dynamically constructing a table and I see that the Width property of the column object is read only; this is really a limitation as I have to create a document that includes lots of pages with tables so I thought about creating a page template that will bind the table object to a dataset. That works great but the column size is fixed. My idea was to override the initial value with whatever value is that i need after creating custom code to bind the table with a dataset, for all those cases that i need different column widths. Is there any way I can work around this limitation?

Re: Column Width as ReadOnly

Support · Mar 28, 2007
Hello, Yes, you can only set the width of the column at the time of creating the table. So in your case a good work around would be to call a function at runtime that generates the table with variable widths for the template. Thanks, ceTe Software Support Team

Re: Column Width as ReadOnly

Forum member · Mar 28, 2007
The problem is that I have MANY tables with many columns that I need to create dynamically. All I need is to adjust the width so the text won't wrap. I cannot hardcode all the values... Is there any way to either: - autosize colums? - use some built-in algorith to calculate the column based on the text length? or do i have to write an auto-size function myself? (hopefully not!!)

Re: Column Width as ReadOnly

Support · Mar 28, 2007
Hello, There is nothing within our product that will allow you to autosize the columns. If the text being added is short and it will fit in one line, you can get the width required for the text using the GetTextWidth() method of the Font class. It takes the string and the font size and returns the width required. You can use this value to set the column width. If the text is going to be several lines, you will have to write the function that autosize the columns. Thanks, ceTe Software Support Team

Re: Column Width as ReadOnly

Forum member · Mar 28, 2007
Ok. Thanks for your response. I think is going to be more work than I was expecting but at least I have clarity regarding what I need to do.... :( I think it will be a great enhancement to your software to either add an auto-size capability for the table columns or to remove the 'readonly' modifier for the width property - That will allow for easier dynamic creation of tables

Re: Column Width as ReadOnly

Support · Mar 29, 2007
Hello, Thank you for your suggestion and we will add your feature request to our wish list. Thanks, ceTe Software Support Team.