07-26-2013 04:32 AM
Hi All,
I need your help!
Im planning to display text report file content in labview string control.
when I read the text file and update the string control, text format alignment was not proper.
but when I open the same text file in notepad, alignment looks good.
how to resolve this text alignment issue ?
Gramy
Solved! Go to Solution.
07-26-2013 05:02 AM
String indicators treat tab constants as whitespace. You could use Search and Replace String to replace all tab constants with a finite number of spaces:
However, this doesn't help if the initial string in the line is a variable character length as your columns will still not line up. You'd need to scan each line of the string (search for line return characters, for instance, to split the lines up) and measure the length of the string before the first tab character (\t), adjusting your number of spaces accordingly.
Or, even better, treat your incoming string as a spreadsheet array (tab delimited), convert accordingly and display in a table. Definitely the right way forward!
07-26-2013 06:08 AM
Another issue is the font you're using in LabVIEW. Notepad is using a fixed-width font and your LabVIEW string indicator is not.
07-26-2013 06:23 AM
While your answer is very well, thoult, there is one possible issue with your suggestion with a string array:
The "separator lines"
-----------------------------------------------------------------
It does not display decently in a table view of a 2D array.
Nevertheless, there are possible ways to address this, but as the OP can see: They have to be implemented specifically.
And Jim is correct that this specific handling could be related to e.g. the used font.
Norbert
07-26-2013 06:40 AM
Pfft, separator line schmeparator line... 😛
Just spitballing:
As Norbert says, you have to implement that specifically. For something that's only decoration, I wouldn't bother myself.
07-26-2013 06:40 AM - edited 07-26-2013 06:41 AM
Edit - removed double post
07-26-2013 10:12 AM
Run into the same problem before.
Simply use a .net textbox to display the text, instead of LabVIEW string.
There is NO need to re-format the string.
08-12-2013 07:40 AM
Thank you so much for all your replies.
I just want to share, I used the same font which is used to print the report in text file, now the text alignment issue is solved...
It looks exactly how it is in notepad editor.
Ram
08-19-2013 10:51 AM
You know why?
Because they use the same window class.