From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you make a table control wrap text like Excel?

I am using LabVIEW 2009, and I am both auto filling, and manual entering of text. I would like the row height to expand or contract to match the string length in a way similar to how Excel uses wrap around. The cell length is fixed, so the row height needs to self adjust. If I enter the text, and it is longer than the cell, I can manually go in and hit shift + Enter to get it to widen the row, and carry the rest of the text to the second line. Is this possible to do automatically, and if so, how is it done?

 

Thank you!

0 Kudos
Message 1 of 8
(5,321 Views)

I don't think this is possible with settings or properties of the table.

 

I have done something similar where I used Courier font (which is a fixed-width font - this is very importnant) and when the Active Cell's string length = X, then make the cell twice as tall (Height sub-property of Active Cell). Where X = the string length where the wrap needs to occur.

 

Does anyone else know of a way?

 

Richard






0 Kudos
Message 2 of 8
(5,308 Views)

Hi again. I looked at my old code, and it makes the cell longer, not taller, sorry. I don't think it's going to word wrap.

Richard






0 Kudos
Message 3 of 8
(5,288 Views)

@broken Arrow wrote:

I don't think this is possible with settings or properties of the table.

 

I have done something similar where I used Courier font (which is a fixed-width font - this is very importnant) and when the Active Cell's string length = X, then make the cell twice as tall (Height sub-property of Active Cell). Where X = the string length where the wrap needs to occur.

 

Does anyone else know of a way?

 


Aside from "update while typing" and checking for each update to decide if a CR needs inserted, no.

 

Re: Fixed width font

 

On the Pictuer pallette there is a "get Text Rectangle" function that will return the size of the rectangle required for the string you pass it using the font you specify. It can be used to "test" how large a string would be if displayed.

 

Take care,

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(5,281 Views)

 


Ben wrote:

On the Pictuer pallette there is a "get Text Rectangle" function that will return the size of the rectangle required for the string you pass it using the font you specify. It can be used to "test" how large a string would be if displayed.

 

Take care,

 

Ben

 


Ben, sounds like a Micro-Nugget! Smiley Wink Up to it?

 

Richard






0 Kudos
Message 5 of 8
(5,266 Views)

Thank you for your replies. I left at noon on Friday, and was out of the office yesterday. I go over what was suggested, and see if something works. I didn't think it was possible, but you never know till you ask! 🙂

 

Thank you!

0 Kudos
Message 6 of 8
(5,201 Views)

Hi

I liked Ben's approach. Attached VI and snippet. 

NickAutosize table cells.png

0 Kudos
Message 7 of 8
(3,083 Views)

I wanted something a little different.  Here's what I came up with,

"If you weren't supposed to push it, it wouldn't be a button."
Message 8 of 8
(2,271 Views)