Word 2007 Automation BUG? in Windows 2008 Service C++

N

N Fiorello

I've been pulling my hair out on this one for two days now:

In my (ok, not mine...the one i'm maintaining) service, I'm making the
following series of calls (error checking, and good style abridged for this
post)

#import "msword.olb" raw_interfaces_only \
rename( "ExitWindows", "EW") \
rename("FindText", "FT")

_variant_t vtFileName("c:\\windows\\temp\\WDEADBEEF.doc");
Word::_ApplicationPtr word;
Word::DocumentsPtr documents;
Word::_DocumentPtr document;

hr = word.CreateInstance(__uuidof(Word::Application));
// succeeds
hr = word.get_Documents(&documents);
// succeeds
hr = documents->Open(&vtFileName, // FileName
&vtMissing, // ConfirmConversions
&vtTrue, // ReadOnly
&vtFalse, // AddToRecentFiles
&vtMissing, // PasswordDocument
&vtMissing, // PasswordTemplate
&vtMissing, // Revert
&vtMissing, // WritePasswordDocument
&vtMissing, // WritePasswordTemplate
&vtMissing, // Format
&vtMissing, // Encoding
&vtVisible, // Visible
&vtMissing, // OpenAndRepair
&vtMissing, // DocumentDirection
&vtTrue, // NoEncodingDialog
&vtMissing, // XMLTransform
&document);

if(SUCCEEDED(hr) && !document)
{
// how did I get here? The document opened successfully but I got no
handle?
}

I've tried using both smart and dumb pointers and get the same results.
I can browse to the file, I know it exists, and I can open it manually in
Word just fine.

So is this a bug? What's wrong? How can I put my hair back in?
 
N

N Fiorello

I've tried everything I could think of. I believe the changes are due to
changes in the service model in 2008. Speicfically the lack of a "desktop
environment" in Session 0. I don't know the full details, but basicly
resources Word needs to run just plain aren't there.

I DO consider it a bug that the method reports success, and then fails. But
that's for Microsoft to contemplate.

Until then we're examining non-microsoft solutions.
 
Z

Zoharat

Have you filed a bug on the Microsoft site for this issue that you are facing?

If yes could you send me a link to it.

Also what other NON Microsoft solutions are you examining?

Are you looking into a third party applicaiton to do this for you?

Any information from you will be really helpful.

Thanks!
 
N

N Fiorello

Currently I'm testing automation of Imagenation 8.2 from Spicer (or whoever
owns them now) and OpenOffice.org Writer.

As to opening a support issue, there's not much point. Microsoft has stated
many times that automating office products from within a service is
unsupported. Besides, even if they change the result of the call to
failure...it still won't do what I need it to.

BTW, automating OOO is not for the Attention Deficit, or the weak of heart :)
 

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