Arno
There are really two different solution to the problem, and they are not compatible.
(1) If you want to write the file so it can easily be read again by a computer or a higher level application (e.g. excel), you need to be strict with tabs and spaces. Inserting extra tabs and spaces will only mess things up.
(2) If you want to dress up your table for purely human visual inspection, it is a different problem. In this case, you should stay away from tabs entirely, because you'll never know how the tabs are set, or if tabs are even supported (such as in a LabVIEW string indicator). You also need to assure that the display is set to a fixed-width font (e.g. Courier). In a proportional font, it will be very hard to line up things because every c
haracter has a different width.
"Filling up the title name with spaces" is simple, just format the short string e.g. with "%15s" and it will magically be padded on the left.
I have attached one possible solution, it probably could be simplified quite a bit. Currently, the fields are right-aligned. Notice that the display is set to Courier, a fixed font.
Another solution would be to generate an HTML table by inserting the proper tags, then display it in a browser.