Word Automation Problem
-
Hello Guys, At work I am developing a new reporting system where this small application will generate the report from an XML file and then gather the data from a database and the process the report in WORD Format. Now after i developed this application and tested it on my development machine it worked compleetly fine. But when i put it into production it was always giving me the same error "Object not set to an instance of an object". After investigating more i found out that it was crashing when it was trying to query how many boookmars there are in the word document, I found out that the Document was not being opend. This is my code below: Microsoft.Office.Interop.Word.ApplicationClass WordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); object filename = System.Configuration.ConfigurationSettings.AppSettings["ReportPath"].ToString() + @"\template\" + TemplateNode.Attributes["path"].Value; object _readonly = false; object isVisable = true; object missing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Document WordDocument = WordApp.Documents.Add(ref filename, ref missing, ref missing, ref missing); This code is resulting in the Object "WordDocument" being null. Now the funny thing is that this works fine in my developemtn machinie but id dosent work correctly on the server. My Development Machine = Windows XP Server = Windows server 2003 Anonye has any ideas as i am lost? Regards, Christian Pace
-
Hello Guys, At work I am developing a new reporting system where this small application will generate the report from an XML file and then gather the data from a database and the process the report in WORD Format. Now after i developed this application and tested it on my development machine it worked compleetly fine. But when i put it into production it was always giving me the same error "Object not set to an instance of an object". After investigating more i found out that it was crashing when it was trying to query how many boookmars there are in the word document, I found out that the Document was not being opend. This is my code below: Microsoft.Office.Interop.Word.ApplicationClass WordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); object filename = System.Configuration.ConfigurationSettings.AppSettings["ReportPath"].ToString() + @"\template\" + TemplateNode.Attributes["path"].Value; object _readonly = false; object isVisable = true; object missing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Document WordDocument = WordApp.Documents.Add(ref filename, ref missing, ref missing, ref missing); This code is resulting in the Object "WordDocument" being null. Now the funny thing is that this works fine in my developemtn machinie but id dosent work correctly on the server. My Development Machine = Windows XP Server = Windows server 2003 Anonye has any ideas as i am lost? Regards, Christian Pace
wrong file path? access restrictions? wrong Office version? a code bug? you need to open your eyes and debug the situation. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]
-
wrong file path? access restrictions? wrong Office version? a code bug? you need to open your eyes and debug the situation. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]
I did the file path is correct, there are no restrictions and the office version is correct i am using the same installation on both the development machine and the server so the word version is the same. and how can it be a code bug when i went trough it on the development machine and it worked fine.
-
I did the file path is correct, there are no restrictions and the office version is correct i am using the same installation on both the development machine and the server so the word version is the same. and how can it be a code bug when i went trough it on the development machine and it worked fine.
a program that has run as anticipated once or twice in a single environment has not proven to be correct. Anyway, something is apparently wrong, so you should doubt all your assumptions one by one, and only trust hard observations. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]
-
a program that has run as anticipated once or twice in a single environment has not proven to be correct. Anyway, something is apparently wrong, so you should doubt all your assumptions one by one, and only trust hard observations. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]
Hi again, I found the following error message in the Event log: The description for Event ID ( 2001 ) in Source ( Microsoft Office 11 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Microsoft Office Word, . Have any idea how i can proceed on this? Thank you very much for your help Regards, Christian Pace
-
Hi again, I found the following error message in the Event log: The description for Event ID ( 2001 ) in Source ( Microsoft Office 11 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Microsoft Office Word, . Have any idea how i can proceed on this? Thank you very much for your help Regards, Christian Pace
cdpace wrote:
Have any idea how i can proceed on this?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]