Strange Word Formatting Issue

C

Chris Morse

I originally posted this to word.vba.general by mistake.

I have an interesting issue involving inserting multiple documents via
automation. I have an application that builds a master document from any
given number of smaller documents. These docs are being stored in binary
field in SQL server. The application builds a dataset of docs for the
current day, loops through them and inserts them into the master document as
illustrated below:

Application.Selection.InsertFile(FileName:=szPath + szFile, Range:="",
ConfirmConversions:=True, Link:=False, Attachment:=False)

Once the master document has been created, some of the formatting is messed
up. Some text is bold, some in italics, bullets are getting lost. If you
look at the source document, all is well though.

Anyone have any experience with this. It's been mind numbingly frustrating.
 
C

Cindy M -WordMVP-

Hi Chris,
I originally posted this to word.vba.general by mistake.
On reading your problem, I don't think posting it there was a mistake. I do
hope you're following any responses you're getting there?
Application.Selection.InsertFile(FileName:=szPath + szFile, Range:="",
ConfirmConversions:=True, Link:=False, Attachment:=False)

Once the master document has been created, some of the formatting is messed
up. Some text is bold, some in italics, bullets are getting lost. If you
look at the source document, all is well though.
Without knowing exactly what the documents contain, and where the changes are
occurring, it's not possible to give you a definitive answer. But based on
general experience with Word, it's likely you're running into the way styles
were designed to behave. See if looking at what's happening through the
"filter" of these guidelines at least explains the behavior you're seeing:

- If two documents contain styles of the same name, the text being imported
will take on the formatting of the style in the target document.

- If formatting is being applied "over" other formatting, things like Bold
and Italic, that are essenially "toggle" formats, will toggle if the same
formatting is applied to them. So if a style definition that is being applied
from the target document includes "bold", and the text coming in contains
"bold", this text will toggle to "non-bold" (while the surrounding text will
now appear bold).

- Numbering is an entire issue all on its own, whether the numbering has been
linked to a style, or not. You'll find some information on numbering and how
it behaves on the mvps.org/word website. Put short and succinctly: your
documents' numbering should be linked to styles, and style names (all kinds)
should be unique to the individual document. Otherwise, you're going to have
conflicts when you bring documents together into a single file.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top