The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Formatting large unbreakable text in cells


I was wondering how could we format text in a cell where text would be very large and not have any spaces like

This_IS+VERY_Large_Text_Without__Periods_and_quotes_and_exclamation _pmarks_and_whatever_With_Repetition_This_IS+VERY_Large_Text_Without__Periods_and_quotes_and_exclamation _pmarks_and_whatever.This_IS+VERY_Large_Text_Without__Periods_and_quotes_and_exclamation _pmarks_and_whatever.

if you use a text area you can specify a hard wrap but is there a way other than programmatically breaking it up ourselve to do this with table cells.

Although its not really world scenario apart from URLs probably but it can still happen and it ruins formatting.

specially if we do not want to specify width in pixels.
Sajid Khan
Friday, July 07, 2006
If this is HTML, you could set the "overflow:hidden" style so the cell would show only what it can fit without breaking formatting.
Friday, July 07, 2006
In your specific example, you can also use the split() function with the underscore as the separator character. Depending on the language you're using, you may also loose the underscore.

Or you can write a loop that uses the left() function and extracts the first 20 characters, inserts a <br>, extracts the next 20 characters, add another <br> and so on.

In all fairness, if we encountered such a long sentence like that, we usually want it to break the table. It serves as a visual reminder that we need to fix the underlying data - as you pointed out, there's almost no real world reason for having a sentence that long, without spaces, and in a table cell explicitly too small for it.
Friday, July 07, 2006
I'm sorry, I misread that. I didn't realize you were looking for non-programmatic solutions.  :)
Friday, July 07, 2006
Thanks for replies.

Before posting I was thinking how well fogbugz would handle it. it seems it is programmatically breaking it up at probably some pre determined number. and it the formatting is going way out of the top forum headline.

I'll test with overflow attribute and let you know.

if its not at all possible in table cells then I would probably experiment more with text area so that they automaticallly resize enough to fit the text and not show the  scroll bar.
Sajid Khan
Saturday, July 08, 2006
Found it

style="WORD-BREAK:BREAK-ALL" but have to set a width to cell as well.
Sajid Khan
Monday, July 10, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz