Office Automation RRS feed

  • Question

  • User1464323581 posted

    I know this isn't supported by microsoft officially but i still want this to work.

    I'm currently developing a windows service that opens a .dot file and then fills this template, save the .doc and print this .doc to a PDF file. So far so good, and this all works from a console application. When i run the exact same code from a Windows Service though i get the following error:

    An unexpected error has occured. Error: Word was unable to read this document.  It may be corrupt.
    Try one or more of the following:
    * Open and Repair the file.
    * Open the file with the Text Recovery converter.

    Now the template simply isn't corrupt, i use it in the console application, and been using it for a while before that. To me it seems to be a security problem where for some reason i'm having trouble opening the template because the process (WINWORD.EXE) is not beeing launched as an interactive user. I've found a few posts suggesting i should edit the launch premissions in DCOMCNFG.exe and things.

    Here i stumble accross the next problem, i'm running Windows 7. My DCOMCNFG for some reason does not show any Office applications.

    Does anyone have any idea how i can realise this?


    F.B. ten Kate

    Tuesday, December 29, 2009 9:04 AM

All replies

  • User1464323581 posted

    Small update, i just installed the service on a windows server 2003 machine, with office 2003 installed (i have 2003 and 2007 on my windows 7 client) and there in the DCOMCNFG it does have a component called. Microsoft Word-document, when i altered the premissions here and made the service run under a account which had word configured it was able to execute the code just fine.

    I'd still very much like to get this working on my development machine though and not just on the server :(

    So any help is most appreciated.

    Tuesday, December 29, 2009 10:37 AM