Creating a document based on a custom template messes up formattin

M

Mike

Hi! I am faced with a peculiar problems. I have a custom made template
which is used to append a variety of documents programmatically (C#, VB-6 or
VBA).
It works OK for most documents. However, if a document has an embedded
picture or an OLE object, very often the document looses some of its
formatting.

I can not figure out what’s going on and what I can do to fix it. Ideally
I’d like to know how I can fix it programmatically but for now I can not even
fix it manually.

I created a test consisting of 2 files which can be downloaded at
http://www.freefilehosting.net/?id=q930lq7R

Here’s how I can duplicate the problem:
Unzip both files. Create a new document based on TEST_TEMPLATE.dot
by right-clicking on the TEST_TEMPLATE.dot file and choosing New.

Once it opens, please do Insert->File and pick the TEST.doc file.

If you compare the resulting file with the TEST.doc you will see what I am
talking about.

Thank you in advance,

--Michael
 
J

Jean-Guy Marcil

Mike was telling us:
Mike nous racontait que :
Hi! I am faced with a peculiar problems. I have a custom made template
which is used to append a variety of documents programmatically (C#,
VB-6 or VBA).
It works OK for most documents. However, if a document has an embedded
picture or an OLE object, very often the document looses some of its
formatting.

It is not a case of losing formatting as it is a case of inserting a file
with wide margins in a file that has very narrow margins...

It is especially obvious with regard to you picture because you set the
picture wrapping to "Square". In the original document, the right margin is
wide so there cannot be any text to the right of the picture. Once you
insert the file in the document created from the tempalte with narrow
margins, the picture is placed in the same position (relative to the right
left margin, or "Column", but now the left margin is so narrow, that some
text fits to the right of the picture, thus apparently throwing your
formatting out of whack...
The same happens with paragraphs that are set to a negative indents. In a
document with wide margins, the text can be easily read, even if it
overflows in the margin area, but once inserted in a narrow-margin document,
some of the text may disappear off the page if the negative indent is wider
than the margin itself.

So, either you make sure that your document have the same margin width, or
you take steps to prevent problem, like not using negative indents and
setting the wrapping to "Square" and "Left Only" (Text Wrapping tab of the
Advanced button found on the Layout Tab of the Picture Format dialog in
Word). But even then, if you use different margins, the amount of ext above
and below the picture may change enough that the result will be
unsatisfactory.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
M

Mike

Hi! Thank you for getting back to me.
Is there anything I can do programmatically to prevent inserted file from
changing its margins and formatting ? As long as it's left-aligned it's fine
with me.

Thank you in advance,

--Michael
 
J

Jean-Guy Marcil

Mike was telling us:
Mike nous racontait que :
Hi! Thank you for getting back to me.
Is there anything I can do programmatically to prevent inserted file
from changing its margins and formatting ? As long as it's
left-aligned it's fine with me.

Well, it is not that simple... Your template has very narrow margins to
accommodate the header graphics. If you change the margins, the text will
not be aligned with the header and the document will look unprofessional.

Also, are you inserting the file programmatically? Or is the user doing it
using the "Insert > File..." menu?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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