Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Word Automation Problem

Word Automation Problem

Scheduled Pinned Locked Moved C#
databasehelpcomsysadminwindows-admin
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cdpace
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • C cdpace

      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

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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]


      C 1 Reply Last reply
      0
      • L Luc Pattyn

        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]


        C Offline
        C Offline
        cdpace
        wrote on last edited by
        #3

        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.

        L 1 Reply Last reply
        0
        • C cdpace

          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.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          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]


          C 1 Reply Last reply
          0
          • L Luc Pattyn

            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]


            C Offline
            C Offline
            cdpace
            wrote on last edited by
            #5

            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

            L 1 Reply Last reply
            0
            • C cdpace

              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

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              cdpace wrote:

              Have any idea how i can proceed on this?

              idea[^] :)

              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]


              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups