Insert Text From File causes loss of text styles

This problem has been occuring for me for years, and going back multiple versions of Word  2003, 2007 and 2010.   It occurs both programatically using Word's VBA to open a .DOC file and insert the contents of another .DOC file.  And also just opening a .DOC file and using Word's Insert -> Text From File.

It does not happen with every document and so far can't pin it down to any thing specific.  Also, it happens with paragraphs and text that are set to regular fonts (i.e. not using Word Styles) and also when creating custom Word Styles and setting the paragraphs to those styles in the doucment that is to be inserted at the end of an existing document. 

All the fonts do exist and all docs were created the same way on the same computer.  Nothing fancy just plain text.

What happens is when the 2nd document is inserted at the end of the open document.  Sometimes entire paragraphs change to a different font, font color and/or font size.   In tests where I set custom Word Styles.   And the same custom Word Style existed in both documents with the same settings - the paragraphs don't have the style setting anymore in the inserted text.

Most of the time it works, but many times it doesn't.   And when it doesn't work, its usually only portions of the document that loose the formatting.

Any idea why this happens and how to prevent it?

January 19th, 2012 9:35pm

I have received your documents. If you mean that the vertical spacing between numbered paragraphs is incorrect in the target document, then the explanation is as follows: The spacing is incorrect in the source as well. You can see that by clicking in the paragraph and pressing Ctrl+Q. In other words, the fix is to remove direct formatting in the source file before inserting it into the target.

To be specific, the direct formatting is Line Spacing set to 1.5 lines in one of the bulleted parag

Free Windows Admin Tool Kit Click here and download it now
July 5th, 2015 2:37pm

Thank you Stefan,

sorry for not explaining more precisely. Firstly it is a mistake that the spacing in the source document isn't according to the style. But isn't it strange that if you examine the settings via Shift+F1, it doesn't inform you of any direct formatting?!

Now to the problem, what I want is that the tabs and the right indent shall apply in the target document. If you press shift+F1 after inserting the sorce into the target, it doesn't apply the settings, but indeed stated that there are direct formatting applied. That is the problem.

Best regards,
Peeter

July 6th, 2015 4:22am

Thank you Stefan,

sorry for not explaining more precisely. Firstly it is a mistake that the spacing in the source document isn't according to the style. But isn't it strange that if you examine the settings via Shift+F1, it doesn't inform you of any direct formatting?!

   

Sorry, I had an error in my previous response (now corrected). The direct formatting added is Line Spacing 1.5 (while the rest of the text is set to "Single"). If you select the option (in the Styles pane) to show the source of formatting, you'll see that if you click in the affected paragraph.

I'll look at the numbering and indents again and post back later.

Free Windows Admin Tool Kit Click here and download it now
July 6th, 2015 9:57am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics