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. How to display pdf & word file

How to display pdf & word file

Scheduled Pinned Locked Moved C#
helpcsharptutorialquestion
6 Posts 4 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.
  • S Offline
    S Offline
    Sajjad Leo
    wrote on last edited by
    #1

    I am trying to open MS word file or PDF fie in my project tel me what should i do for this. I have searched on net but still i am facing problem in this code which is, if (this.openFileDialog1.ShowDialog() == DialogResult.Yes) { // set the file name from the open file dialog object fileName = openFileDialog1.FileName; object readOnly = false; object isVisible = true; // Here is the way to handle parameters you don't care about in .NET object missing = System.Reflection.Missing.Value; // Make word visible, so you can see what's happening WordApp.Visible = true; // Open the document that was chosen by the dialog Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible); // Activate the document so it shows up in front aDoc.Activate(); // Add the copyright text and a line break WordApp.Selection.TypeText("wFile.doc"); WordApp.Selection.TypeParagraph(); } In Bold code their is error this is not working. WHAT SHOULD I DO ?

    L 1 Reply Last reply
    0
    • S Sajjad Leo

      I am trying to open MS word file or PDF fie in my project tel me what should i do for this. I have searched on net but still i am facing problem in this code which is, if (this.openFileDialog1.ShowDialog() == DialogResult.Yes) { // set the file name from the open file dialog object fileName = openFileDialog1.FileName; object readOnly = false; object isVisible = true; // Here is the way to handle parameters you don't care about in .NET object missing = System.Reflection.Missing.Value; // Make word visible, so you can see what's happening WordApp.Visible = true; // Open the document that was chosen by the dialog Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible); // Activate the document so it shows up in front aDoc.Activate(); // Add the copyright text and a line break WordApp.Selection.TypeText("wFile.doc"); WordApp.Selection.TypeParagraph(); } In Bold code their is error this is not working. WHAT SHOULD I DO ?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Sajjad Leo wrote:

      WHAT SHOULD I DO ?

      State the error that you are getting and use the <pre> tag around code when you're posting :)

      I are troll :)

      S 1 Reply Last reply
      0
      • L Lost User

        Sajjad Leo wrote:

        WHAT SHOULD I DO ?

        State the error that you are getting and use the <pre> tag around code when you're posting :)

        I are troll :)

        S Offline
        S Offline
        Sajjad Leo
        wrote on last edited by
        #3

        This is the error no overload for method 'open' takes '12' arguments

        M 1 Reply Last reply
        0
        • S Sajjad Leo

          This is the error no overload for method 'open' takes '12' arguments

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #4

          Sajjad Leo wrote:

          no overload for method 'open' takes '12' arguments

          then thats your problem. Do you not understand that simple message? if your IDE doesnt help with params then search for the function signature on google. you should find that the Open function wants 15 params, 3 more (15 - 12) than you are giving it

          Life goes very fast. Tomorrow, today is already yesterday.

          S 1 Reply Last reply
          0
          • M musefan

            Sajjad Leo wrote:

            no overload for method 'open' takes '12' arguments

            then thats your problem. Do you not understand that simple message? if your IDE doesnt help with params then search for the function signature on google. you should find that the Open function wants 15 params, 3 more (15 - 12) than you are giving it

            Life goes very fast. Tomorrow, today is already yesterday.

            S Offline
            S Offline
            Sajjad Leo
            wrote on last edited by
            #5

            ok i am trying to find more three but do you any idea then tell me well thanx ....

            F 1 Reply Last reply
            0
            • S Sajjad Leo

              ok i am trying to find more three but do you any idea then tell me well thanx ....

              F Offline
              F Offline
              Fayu
              wrote on last edited by
              #6

              your problem is that you are passing too many parameters in the open method. Use intellisense to find out what parameters the method accepts.

              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