Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

Creating a document based on a custom template messes up formattin

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 01 Feb 2006 22:59 GMT
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
Jean-Guy Marcil - 02 Feb 2006 14:53 GMT
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.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Mike - 02 Feb 2006 23:00 GMT
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

> Mike was telling us:
> Mike nous racontait que :
[quoted text clipped - 30 lines]
> and below the picture may change enough that the result will be
> unsatisfactory.
Jean-Guy Marcil - 03 Feb 2006 06:58 GMT
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?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.