04-13-2010 10:49 AM
Hello,
I'm using LabVIEW 7.0, and I need to populate some tables with data. I can't seem to find a way to center justifiy the data in the table. Did they really forget to include this ability? Sounds like too much of an oversite for the folks at NI. Does anyone know how to center justify the data in a table?
Thanks.
04-13-2010 10:52 AM
In 2009 it is
Active Celll >>> Cell justification
Ben
04-13-2010 11:08 AM
04-13-2010 11:15 AM
rickford66 wrote:
No such selection in 7.0.
Correct!
Ben
04-13-2010 12:48 PM
Do you need to center the data just for aesthetics, or for printing? If so, you can pad the strings with spaces to the left to center each cell.
If you know the expected maximum string length, it's not too difficult. You need to pad the strings with spaces to meet the minimum field length, then use split string (split it where the spaces start) and then reverse-concatenate (swap) the spaces on the end with the original characters. Something like that. I might have an example somewhere.
04-13-2010 01:41 PM
That sounds like it might work, but I'm new to this. My immediate question is, how do I know how many character spaces it will hold. I ask because it has been my experience that different characters take up different amount of space... so depending on what is being displayed, the amount of characters may vary.
BTW, I need this for printing.
04-13-2010 01:54 PM
rickford66 wrote:That sounds like it might work, but I'm new to this. My immediate question is, how do I know how many character spaces it will hold. I ask because it has been my experience that different characters take up different amount of space... so depending on what is being displayed, the amount of characters may vary.
BTW, I need this for printing.
On the "Picture Functions" pallette of LV 7.0 there is a function called "Get Text Rect.vi". If you pass it a string along with the font style and size you are using, it will return a cluster that defines the rectangle required to for that text.
You can use that VI to determine the size.
I can not speak for how easy this will be if you use a font with different widths. I believe there are fonts with fixed width out there somewhere.
Ben
04-13-2010 02:37 PM
04-13-2010 02:43 PM - edited 04-13-2010 02:44 PM
Here's an example I whipped up in version 9, but these functions should be available in version 7.
04-13-2010 02:46 PM
Thanks for all your help. I just (minutes ago) got taken off this part of the project and moved to a more "urgent" part of the project. I will have to try that when I get back to it. Thanks so much.
Rick