I'm designing an application with a data table. The data is backed by a C-style string (that is to say, a char array) so I know the maximum theoretical width using my proportionally-spaced typeface.

For example, assume that a string's length can't be greater than 32 characters. Naively, I can say that since "W" is the widest character, the maximum theoretical column width is 32 times the width of "W". But this will pretty much never happen, and if I make my column as wide as 32 "W"'s there'll be a lot of wasted space on average. On the other hand, it's not the end of the world if a string runs long and is truncated; I just want the vast majority of strings to be represented in their entirety.

Is there a back-of-the-envelope calculation for estimating the ideal default column width?

  • Simply use an existing table that adjusts its column widths depending on what the width of the widest item is in each column. Dec 5, 2012 at 18:46
  • @AndroidHustle: The table is virtualized and can have over 100,000 items. Unfortunately that's not an option in this case. Dec 5, 2012 at 18:52
  • 1
    This question appears to be off-topic because it is about a calculation that would be better suited on stackoverflow.com. Feb 27, 2014 at 21:40

1 Answer 1


If (as you say) truncation is acceptable, then the question is more about:

  • what you expect the column width do be most of the time
  • what other columns also have to fit next to it
  • how wide the expected screen resolution will be
  • how much can be truncated without being a problem

These are all things that require a subjective evaluation, which you have to make and then test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.