Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Trimming doesn't seem to be working (Read 3267 times)
consolejoker
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Dec 17th, 2007
Trimming doesn't seem to be working
Mar 18th, 2008 at 8:49pm
Print Post  
I have in my table cell the 2nd column with values that are too long to fit. I tried using the StringTrimming options, I would like it to cut short and add a few "..." to the end to signify that it's cut short.

However none of the trimming option values seem to be providing this behavior. All my values are technically one word, with underscores in them.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Trimming doesn't seem to be working
Reply #1 - Mar 19th, 2008 at 9:29am
Print Post  
The text formatting algorithm used with EnableStyledText supports only StringTrimming.Word and StringTrimming.Character. If you need just the underline, you can specify it as an attribute of the cell.Font, instead of using styled text and <u></u> tags. In that case the table would use the standard DrawString method, which supports the StringTrimming.Ellipsis* values as well.

Stoyan
  
Back to top
 
IP Logged
 
consolejoker
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Dec 17th, 2007
Re: Trimming doesn't seem to be working
Reply #2 - Mar 20th, 2008 at 12:28pm
Print Post  
Stoyo wrote on Mar 19th, 2008 at 9:29am:
The text formatting algorithm used with EnableStyledText supports only StringTrimming.Word and StringTrimming.Character. If you need just the underline, you can specify it as an attribute of the cell.Font, instead of using styled text and <u></u> tags. In that case the table would use the standard DrawString method, which supports the StringTrimming.Ellipsis* values as well.

Stoyan


let me back up a bit, i'm finding that it has nothing to do with underscores. Its just that if I have a long word that exceeds the width of the cell, it will not get shortened with elipses, it just runs off the cell and gets clipped by the table border.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Trimming doesn't seem to be working
Reply #3 - Mar 20th, 2008 at 1:03pm
Print Post  
Disable the StyledText property and set the cell's TextFormat.StringTrimming to EllipsisCharacter; then the text will be shortened with ellipsis.
  
Back to top
 
IP Logged
 
consolejoker
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Dec 17th, 2007
Re: Trimming doesn't seem to be working
Reply #4 - Mar 20th, 2008 at 5:19pm
Print Post  
Stoyo wrote on Mar 20th, 2008 at 1:03pm:
Disable the StyledText property and set the cell's TextFormat.StringTrimming to EllipsisCharacter; then the text will be shortened with ellipsis.


Ah very cool. Can the same thing be done for captions? Guess not since I don't see a TextFormat for the caption.
  
Back to top
 
IP Logged
 
consolejoker
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Dec 17th, 2007
Re: Trimming doesn't seem to be working
Reply #5 - Mar 20th, 2008 at 5:20pm
Print Post  
Actually I found the format for Caption, but it seems if I exceed the width of the caption area it just wraps around onto a 2nd line and breaks up everything.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Trimming doesn't seem to be working
Reply #6 - Mar 21st, 2008 at 11:08am
Print Post  
You should also enable the NoWrap format flag:

TableNode table = new TableNode(diagram);
table.EnableStyledText = false;
table.CaptionFormat.Trimming = StringTrimming.EllipsisCharacter;
table.CaptionFormat.FormatFlags = StringFormatFlags.NoWrap;
table.Caption = "this is a very long caption text";
diagram.Nodes.Add(table);

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint