I use this to do a find and replace and then save the Word document. Yes! I have a C# ASP.NET app that is calling the Microsoft Offce 2007 (Word) interop. Would not work, since the user who runs the process is the same that I defined here… Any ideas will be appriciated. I also don’t really get why the DCOM Config “The launching user” I have UAC activated on my Win7 and I didn’t try if turning it off would solve the issue too. And in the properties I set Identity to a specific user (with Admin Rights).Under DCOM Config I found an entry Microsoft Word 97 – 2003 Document.So this is what I did to solve the problem: I was trying different things and searching the internet, desperate for a solution and not far from ripping my hair out, when I finally found this thread where you give the hint to look up the DCOM Config.
I couldn’t figure out why that would happen, since both the win service and the winword.exe processes where running under the right user account, which had all the rightsĪnd privileges needed. Office = new Office(OfficeVersion.Office2007)
#Word documents open returns null code#
But running the code in a windows service the Method would always return When I executed the code below in a WinForms App (OS: Win7) everything worked fine. Since I want to run my code indepentend to whether Word2003 or Word2007 is installed, I wrote a simple Wrapper Library in which I load the adequate Word Assembly at runtime invoking
If the end-of-file is encountered while attempting to read a character, the eof indicator is set ( feof). Stdin can be used as argument to read from the standard input.
stream Pointer to a FILE object that identifies an input stream. num Maximum number of characters to be copied into str (including the terminating null-character). Parameters str Pointer to an array of chars where the string read is copied. Notice that fgets is quite different from gets: not only fgets accepts a stream argument, but also allows to specify the maximum size of str and includes in the string any ending newline character. Reads characters from stream and stores them as a C string into str until ( num-1) characters have been read or either a newline or the end-of-file is reached, whichever happens first.Ī newline character makes fgets stop reading, but it is considered a valid character by the function and included in the string copied to str.Ī terminating null character is automatically appended after the characters copied to str.