Saving Word 2007 document in temp file

S

Stepan

I would like to save a _copy_ of the Word 2007 document. There is no
function in object model like Word::_Document->SaveCopyAs.
The good resolution for Word 2003 is to use IPersistFile, this was
suggested by Eugene Starostin in 2004 (http://groups.google.ru/group/
microsoft.public.office.developer.com.add_ins/browse_thread/thread/
659545eb64b4787d).

CComPtr<IPersistFile> persistFile =
QueryInterface<IPersistFile>( document );
persistFile->Save( newFileName, false );
persistFile->SaveCompleted( newFileName );

But it does not work for Word 2007 for loaded documents. This just
saves document to previous storage ignoring newFileName.

I tried to use IPersistStorage, but this interface saves to IStorage
the document without unsaved changes.

Can anybody solve this problem?
Stepan.
 
S

Stepan

Oh, I've got the resolution!

_bstr_t wordXML = document->GetWordOpenXML();

Then everyone can write this wordXML to "FileName.xml".
This is very simple!

Best regards from Russia,
Stepan.
 

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