Following on from Case of the Corrupted Word Formatting Here https://chentiangemalc.wordpress.com/2013/05/21/case-of-the-corrupted-word-formatting/
So I had this table in Word 2013 like so:
However while editing something not obviously related in the document indents appeared:
I could “delete” the indent with a backspace key, but even showing special characters, there didn’t seem to be anything obvious there (like a TAB character which would have shown up as a right arrow)
Most of the time this could be fixed by “cutting” the table then pasting it, and selecting merge formatting option. In some cases this didn’t fix the formatting, and it required a paste into excel, then copy paste back into Word.
So I created two .docx just with the one table in it- one with the bad format, one with the “merge formatting” fix. To ensure documents were as similar as possible I created the first document, pasted bad table, saved my “bad docx”, then cut the table from same document, pasted it with merge settings in same location as previous table, and saved as “good docx”
I then renamed both .docx to .ZIP and extracted their contents.
I compared the extracted folders in Beyond Compare, initially i only compared file sizes, as word embeds time/date stamps in many files that I didn’t want to compare.
The most obvious document was documents.xml, I opened up each \word\documents.xml file in PSPad Editor and applied HTML Reformat HTML code to make them easier to read:
We could than easily see difference in Beyond Compare:
In the “good” version we had
<w:spacing w:after=”160″ w:line=”259″ w:lineRule=”auto”/>
In the “bad” version we had
So I suspect w:val=ParaText the root cause of our issue…
So for first fix I tried removing it for the one cell:
I saved the XML and re-zipped the contents, renamed back to .DOCX:
Sure enough one cell was fixed:
We can see this when we search ParaText in Word\Styles.xml from an extracted DOCX.
<w:style w:type=”paragraph” w:customStyle=”1″ w:styleId=”ParaText”>
<w:name w:val=”Para Text”/>
<w:spacing w:before=”60″ w:after=”60″ w:line=”240″ w:lineRule=”auto”/>
<w:rFonts w:ascii=”Arial” w:eastAsia=”SimSun” w:hAnsi=”Arial” w:cs=”Times New Roman”/>
<w:lang w:val=”en-AU” w:eastAsia=”en-US”/>
One way to fix this would be to select all text in every table on every page in the document and set to “Normal Style””
However in a 300 pages+ word document, that seemed like a hassle.
So I put cursor on some affected text, then selected Apply Styles…
This brought up an Apply Styles window. Notice how the original style view didn’t show this style name at all? I think we found our Para Text
I then modified the paragraph format option:
And reset the left indent from 2cm to 0cm
Now all the tables in document were fixed
My paragraphs may be missing indents, but at least the tables are readable…