How to raise the OnNew event when usind Word.Documents.Add

K

KnowledgeSeeker

I read that the OnNew event can be raised through the command prompt to make sure the word document open from a dot template keeps the formatting attached to that template instead of the ones in the normal dot template on the user's computer. IS there any way to programmatically do that same thing in VB.Net when working with the word document object model (especially when loading Word with the Word.Documents.Add command)?
 
J

Jezebel

A new document automatically keeps the formatting and styles of the attached
template. That's the whole point of templates. It doesn't take on the styles
from normal.dot.


KnowledgeSeeker said:
I read that the OnNew event can be raised through the command prompt to
make sure the word document open from a dot template keeps the formatting
attached to that template instead of the ones in the normal dot template on
the user's computer. IS there any way to programmatically do that same thing
in VB.Net when working with the word document object model (especially when
loading Word with the Word.Documents.Add command)?
 
K

KnowledgeSeeker

Thank you Jezebel for quickly answering my question.
I guess I should be more specific about the problem I am experiencing:
Basically the dot were created on pushed onto a location on a server. The application then reatrieves the data based on the business request and merges the data into a template. Now the problem is that after that is done, a document that was initially created and supposed to be a two page-document ends up displaying on the user's computer as three or even more pages on the user's computer. The only explanation we had was that it was not using the formatting in the template and that was the reason I posted my question to try to solve but based on what you just there must be something else causing that problem. Is anyone familiar with such issue? If so how can I fix.
Thanks.
 
J

Jezebel

There is a setting on Tools > Templates and add-ins 'Automatically update
document styles'. If this is checked, then when the document is opened the
document's styles are reset to the styles as defined in the template.
However, this happens only if the user's computer has a template of the same
name as that used to create the document. If the template is not found, the
document is not update. It does not revert to the definitions in the user's
copy of normal (unless that was the name of the template you used). And if
that checkbox is not set, no updating happens anyway.

First, I suggest you print out a copy of the document as it is supposed to
look, then a copy from one of the other machines, overlay them, hold them up
to a window, and check what the differences actually are. Different
typefaces? Different margins?

Check that all users have the all the fonts used.
Check that there's nothing odd happening with paper sizes. You'll get
resizing if Word thinks it's printing on A4 but the printer is configured
for Letter size.




KnowledgeSeeker said:
Thank you Jezebel for quickly answering my question.
I guess I should be more specific about the problem I am experiencing:
Basically the dot were created on pushed onto a location on a server. The
application then reatrieves the data based on the business request and
merges the data into a template. Now the problem is that after that is done,
a document that was initially created and supposed to be a two page-document
ends up displaying on the user's computer as three or even more pages on the
user's computer. The only explanation we had was that it was not using the
formatting in the template and that was the reason I posted my question to
try to solve but based on what you just there must be something else causing
that problem. Is anyone familiar with such issue? If so how can I fix.
 

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