Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Spacing all messed up.

Status
Not open for further replies.

dswaff

IS-IT--Management
Aug 10, 2015
21
0
0
US
I have a text file that I need some users to open in word.
I created the file via VBScript.
In notepad or notepad++ the file looks great.

Open the same file in word and the tab spacing is all messed up. Some times items in a row are single tabbed, or triple tabbed.

What can I do to make it format / read right?
 
Not necessarily – I can set my Notepad to use Arial or Wingdings font.:)

But if “In notepad or notepad++ the file looks great.” – why do you want to display it in Word?


Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
I can set it - does not mean I do set it to Arial :)

In my Notepad I use Courier New, but if I have to choose between Times New Roman and Arial, I use Arial because I hate Times New Roman.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
I wanted to use word because that is what is on everyone desktop. This will not be for my use but our data clerks.
Notepad and notepad++ dont recognize page breaks. Word does. I am up for suggestions. I did try mono space fonts. Doesn't fix it :(

The text file come from an asa/400 with old line printer formatting.

The VBscript I made removes the line printer formatting:
Set fso = CreateObject("Scripting.FileSystemObject")
Set regEx = New RegExp
'find tab spaces.
regEx.Pattern = "^(' ')"
regEx.Global = True
regEx.MultiLine = True
txtFile = regEx.Replace(fso_OpenTextFile(WScript.Arguments(0)).ReadAll, vbTAB)
'Find all asa line feeds
regEx.Pattern = "^(' ')"
regEx.Global = True
regEx.MultiLine = True
txtFile = regEx.Replace(fso_OpenTextFile(WScript.Arguments(0)).ReadAll, vbLF)
fso_OpenTextFile(WScript.Arguments(0), 2, True).Write txtFile
' Find all asa carriage returns
regEx.Pattern = "^(0)"
regEx.Global = True
regEx.MultiLine = True
txtFile = regEx.Replace(fso_OpenTextFile(WScript.Arguments(0)).ReadAll, vbCRLF & " ")
fso_OpenTextFile(WScript.Arguments(0), 2, True).Write txtFile
'Find all ASA Page Breaks
regEx.Pattern = "^(1)"
regEx.Global = True
regEx.MultiLine = True
txtFile = regEx.Replace(fso_OpenTextFile(WScript.Arguments(0)).ReadAll, " ")
fso_OpenTextFile(WScript.Arguments(0), 2, True).Write txtFile






Here are screenshots of what happens.
Good Notepad
Bad word
 
In Word select all text.

Toggle the Formatting Marks ON

select a Courier font

Select a font size of 8

Show the Ruler

With ALL TEXT SELECTED, you can add, move, remove TABS to align the columns as required.



Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Ok, so turns out I made an assumption...and we all know what that does.

I compared the text file hidden chars with the word file hidden chars.
They are the same. There is no tab char, only spaces.

So I have been researching MONOSPACE Fonts. Looks like they are not working correctly in word.
And ones that are supposed to be monospace fonts are not true monospace fonts in word.

I am trying to find one to download that works correctly.
Looks like the font is the problem this whole time.
Any suggestions.
 

As you can see Courier IS a monospace font!

If you can save a test copy of your Word. Find & Replace several characters with Z to protect your data, and UPLOAD your file so we can see what you're working with.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Yes Courier is a monospace font. However in windows word, it is monospace only in height for some reason, not width.
I have tested a bunch of monospace fonts and they all have the same symptom.
I found on stock exchange someone was having the same problem, but with a diffrent program:
 
and a test file upload?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Okay so I finally figured it out. I tried multiple editors. word, WPS,openoffice. All do the same thing.
First of course select your monospaced font and text size.
I then had to Go into font settings of the Office suite you decide to use.
Turn off Font Kerning and change the font space setting to expanded by 0.176389 mm


Lines right up.

 
I would like to know why I have to change the extra settings and you do not.
That seems most odd to me.
 
Looks just fine in my Word using these settings...

Landscape

Narrow margins

Font Courier New size 8



Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Ok I did the same thing no effect till I changed the other settings.....That is going to make me nutty.

I appreciate all of your help and sticking with me through this.
 
BTW, "monospace only in height" is meaningless! Monospace refers to horizontal character spacing, also called fixed pitch or fixed width.

[URL unfurl="true" said:
https://en.wikipedia.org/wiki/Monospaced_font[/URL]]
A monospaced font, also called a fixed-pitch, fixed-width, or non-proportional font, is a font whose letters and characters each occupy the same amount of horizontal space

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Please describe exactly what is happening.

Please describe exactly how your Word is configured.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top