Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncating cell text

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
I'm using HTML to generate a spreadsheet-style report and I wondered if there was a way using Styles to force the contents of a cell to truncate rather than word-wrap?

So for example:
"This might be a cell with a particularly long phrase"
would become:
"This might be a cell with (...)"

The (...) would appear at the place where the text would otherwise automatically wrap.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Nope, this is not possible with HTML or CSS, you would need to resort to some sort of server-side (or client-side, though I would not recommend that) scripting. With CSS, all you could do is hide some of the text in a box that has overflow set to hidden and height and width constrained. If you put an element like that in your table cell, that would do it, but it probably won't look very nice.

[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
If this is for an IE-only intranet, then you could investigate the "text-overflow:ellipsis;" style.

Hmm - perhaps this would help with a cross-browser version?


Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Thanks, I'll check that link. Yes, the report only ever appears in a WebBrowser object so it only needs to be IE compatible.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top