popup documents

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prokopis
    New Member
    • Nov 2007
    • 30

    popup documents

    hello.
    am doing c# windows application and i need some help.
    is it possible to read a .doc file and to be display in the screen with the microsoft office??
    am able to read a file and display it in a messagebox but i don't know how to display it in microsoft office.
    can someone help me please???
  • dip_developer
    Recognized Expert Contributor
    • Aug 2006
    • 648

    #2
    Originally posted by prokopis
    hello.
    am doing c# windows application and i need some help.
    is it possible to read a .doc file and to be display in the screen with the microsoft office??
    am able to read a file and display it in a messagebox but i don't know how to display it in microsoft office.
    can someone help me please???
    try this........... .....

    [CODE=css]
    {
    ///Setup environment for Word application
    Word.Applicatio n objWord;
    Word.Document objDoc;
    string strFile;

    ///Instansiate Microsoft Word
    objWord = new Word.Applicatio n();
    ///Allow session to be visible
    objWord.Visible = true;
    ///Define source file container and name
    strFile = TextBox1.Text;
    ///Open the document
    objDoc = objWord.Documen ts.Open(strFile );
    }
    [/CODE]

    Comment

    • prokopis
      New Member
      • Nov 2007
      • 30

      #3
      it give me this error
      Error 1 The type or namespace name 'Word' could not be found (are you missing a using directive or an assembly reference?)
      i try to add a namespace for word but i can find anything.
      could you please help me?
      instead of ms word is it possible to use and pdf???

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        You need to add a reference to the MS office DLLs so that you can work with the office objects/APIs.

        Comment

        • dip_developer
          Recognized Expert Contributor
          • Aug 2006
          • 648

          #5
          Originally posted by prokopis
          it give me this error
          Error 1 The type or namespace name 'Word' could not be found (are you missing a using directive or an assembly reference?)
          i try to add a namespace for word but i can find anything.
          could you please help me?
          instead of ms word is it possible to use and pdf???
          Right click on the Reference node of your .net solution......t hen
          Add Reference------>on Add Reference window go to COM tab-----> locate Microsoft Office 11.0 Object Library------>Click Select button---the OK.....
          it will add the reference of the required DLL to work with Microsoft WORD

          Comment

          • prokopis
            New Member
            • Nov 2007
            • 30

            #6
            Originally posted by dip_developer
            Right click on the Reference node of your .net solution......t hen
            Add Reference------>on Add Reference window go to COM tab-----> locate Microsoft Office 11.0 Object Library------>Click Select button---the OK.....
            it will add the reference of the required DLL to work with Microsoft WORD

            There is Microsoft Office 12.0 Object Library and not what you have told me.did it do any different because it still give me tha same error?

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              The library you have is based on what version of office you have.
              11 is very common. 12 is probably officexp?
              At any rate, do some conscious thinking and use THAT one then.
              These things can easily be looked up on google.

              Comment

              • prokopis
                New Member
                • Nov 2007
                • 30

                #8
                thxs.it was very helpfull and is working

                Comment

                Working...