Strange formatting issue

C

Chris Morse

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.
 
D

dz

If I understand you correctly, your "master document" is
not really using the Master-Subdocument feature of Word.
So, it appears you have conflicting styles in the separate
documents. So, every time a new document is
inserted/appended, its styles are overriding the existing
document styles.

It sounds like you have a lot of documents that this
affects, so unless someone else has a better idea, you
will need to replace the styles in each doc as follows:

Locate a document that has the most styles used (i.e.,
bullet type, heading type, etc.) and use this as your base
(make sure it isn't open). Then use the organizer (tools,
templates and add-ins and make sure your base document is
specified in the right-hand side - choose close, then
open, then locate your doc). On the left-hand side, for
each of the other docs, choose close, then open and find
the doc. Then copy the styles from the base document into
each of the other docs.

This can be done programmically if you have a lot of
documents.
 

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