I have a few columns where the .columnwidth property should be determined by autofit because the data is variable, but each column's width should be no more smaller or larger than a defined range of allowed widths.
At the moment, I'm doing the autofit and then testing .columnwidth afterwards, and if .columnwidth is outside the range, the code then changes .columnwidth to the minimum or maximum, whichever is closer (whichever has been exceeded).
The trouble with this approach is that .columnwidth is being changed twice per column (sometimes three times because of another part of the code) if it falls outside the range of allowed widths. It takes quite a while, roughly half a second, for the code to apply a change to .columnwidth and when this is multiplied out by the number of columns being resized, it turns an otherwise quick code into something that takes a minute or more.
Really what I want to do is workout what .columnwidth would be after autofit has been applied, but before applying it. That way I can deal with the range of allowable widths before .columnwidth is changed in the first instance.
I suspect getting some kind of size attribute for a string within a column and then somehow converting that to a measurement unit that can be compared with the value of .columnwidth. But I'm stumped as to exactly how to achieve it and would really appreciate the help of you good folk.
Many thanks
Kadeo
Bookmarks