Word Automation C++

S

Steve S.

I'm automating Word from C++ (imported msword8.olb & using tlh / smart
pointers ). Not using MFC.

I've been at this one for 3 days - still can't pull it off ... time
constraints have me almost behind
the 8 ball on this one....

What I'm trying to do is the following:

a) Create a new document (no problem there)
b) I have 5 metafiles where I loop through and have to insert 1 metafile per
word page. Using:

m_pWord->ActiveDocument->Shapes->AddPicture( ) for this.


The problem - the pages are added ok - however - all metafiles end up
overlayed on the 1st page...

I have tried moving to the different pages as they are added ( I see this
happening since I make Word visible and put a pause between page adds /
image adds ) - but to no avail - all metafiles end up on the 1st page...

Has anyone done a similar thing in C++?

Thanks in advance.


Steve.
 
C

Cindy Meister -WordMVP-

Hi Steve,

I don't work with C++, but...

I question whether you really want SHAPES, or whether you couldn't use
INLINESHAPES, that behave like text characters in the document, and would
therefore reliably allow themselves to be placed on the page.

If you are going to use shapes, then you have to understand the concept of
ANCHORS, that tell shapes to which paragraph.range they belong. Then you have
to be sure to specify a paragraph range when using the .addpicture method
(Anchor argument)
a) Create a new document (no problem there)
b) I have 5 metafiles where I loop through and have to insert 1 metafile per
word page. Using:

m_pWord->ActiveDocument->Shapes->AddPicture( ) for this.


The problem - the pages are added ok - however - all metafiles end up
overlayed on the 1st page...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 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 :)
 
S

Steve S.

Cindy,

thank you very much - I got it working Ok.

I only notice one problem now ... it seems Word 2000 (no problems with 97)
keeps the EMF files locked even after I have made Word save and quit... The
metafiles are not linked to the document.

Any idea on this problem?

Thanks.

Steve.
 
S

Steve S.

Cindy,

thank you very much - I got it working Ok.

I only notice one problem now ... it seems Word 2000 (no problems with 97)
keeps the EMF files locked even after I have made Word save and quit... The
metafiles are not linked to the document.

I need to delete the temp emf files...

Any idea on this problem?

Thanks.

Steve.
 
C

Cindy Meister -WordMVP-

Hi Steve,

Sorry, no idea, really.

If you quit, then restart Word can they be deleted?
I only notice one problem now ... it seems Word 2000 (no problems with 97)
keeps the EMF files locked even after I have made Word save and quit... The
metafiles are not linked to the document.

I need to delete the temp emf files...

Any idea on this problem?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 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