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 using C#

Word automation using C#

Scheduled Pinned Locked Moved C#
helpcsharptestingbusinesstools
9 Posts 5 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.
  • N Offline
    N Offline
    Niks7755
    wrote on last edited by
    #1

    Hello, I want to create word document using c#,now i did the task to create simple word document using word DLL. now my requirement is to make more automation on created word document through c# code,required automation as describe below... -> Define header and footer,footer contains page number,while header contains some text but i need that header change on odd and even pages,which is property of word "Different Odd & Event Pages". -> define the fix page size,and need to define margin from 4 different side. so please help me to short out my requirements. Thanks, Kaushal.

    M P R 3 Replies Last reply
    0
    • N Niks7755

      Hello, I want to create word document using c#,now i did the task to create simple word document using word DLL. now my requirement is to make more automation on created word document through c# code,required automation as describe below... -> Define header and footer,footer contains page number,while header contains some text but i need that header change on odd and even pages,which is property of word "Different Odd & Event Pages". -> define the fix page size,and need to define margin from 4 different side. so please help me to short out my requirements. Thanks, Kaushal.

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

      Why don't you do some research and try it for yourself. WordApplication and WordDocument have many functions and properties to help you meet your requirements. Why not start here[^]

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

      N 1 Reply Last reply
      0
      • M musefan

        Why don't you do some research and try it for yourself. WordApplication and WordDocument have many functions and properties to help you meet your requirements. Why not start here[^]

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

        N Offline
        N Offline
        Niks7755
        wrote on last edited by
        #3

        hello musefan, I have already search out on msdn as well as many more sites,but still i can get only which already i have implement,but i am not getting that much things which is describe in previous post and i am also continue with searching more.

        nikunj padaliya

        M 1 Reply Last reply
        0
        • N Niks7755

          hello musefan, I have already search out on msdn as well as many more sites,but still i can get only which already i have implement,but i am not getting that much things which is describe in previous post and i am also continue with searching more.

          nikunj padaliya

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

          hmmm... Headers and Footers[^]

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

          N 1 Reply Last reply
          0
          • N Niks7755

            Hello, I want to create word document using c#,now i did the task to create simple word document using word DLL. now my requirement is to make more automation on created word document through c# code,required automation as describe below... -> Define header and footer,footer contains page number,while header contains some text but i need that header change on odd and even pages,which is property of word "Different Odd & Event Pages". -> define the fix page size,and need to define margin from 4 different side. so please help me to short out my requirements. Thanks, Kaushal.

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            Are you tied to creating this document through automation? If not, and you are targetting Office 2003 or Office 2007, why not generate the document using WordML? What you would normally do, is generate a dummy document that matched the formatting you want, and then use this as a basis for applying the styling that you want via XML. The advantage of this approach, is you don't need to have Word installed on a target machine to make use of this technique, which is great if you run this on a server.

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            N 1 Reply Last reply
            0
            • P Pete OHanlon

              Are you tied to creating this document through automation? If not, and you are targetting Office 2003 or Office 2007, why not generate the document using WordML? What you would normally do, is generate a dummy document that matched the formatting you want, and then use this as a basis for applying the styling that you want via XML. The advantage of this approach, is you don't need to have Word installed on a target machine to make use of this technique, which is great if you run this on a server.

              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

              As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

              My blog | My articles | MoXAML PowerToys | Onyx

              N Offline
              N Offline
              Niks7755
              wrote on last edited by
              #6

              Hi, Thanks for your reply,i can understand your suggestion,for that can you provide me any example or any reference link,through which i can do it.

              nikunj padaliya

              S 1 Reply Last reply
              0
              • M musefan

                hmmm... Headers and Footers[^]

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

                N Offline
                N Offline
                Niks7755
                wrote on last edited by
                #7

                Hi musefan, Thanks for your link,i can go through that and use that code for creating header on my application but when document is generated than i couldn't get the header text,it gives error like "Error! Auto Text entry not defined." Thanks & Regards Kaushal.

                nikunj padaliya

                1 Reply Last reply
                0
                • N Niks7755

                  Hi, Thanks for your reply,i can understand your suggestion,for that can you provide me any example or any reference link,through which i can do it.

                  nikunj padaliya

                  S Offline
                  S Offline
                  shravaniraj
                  wrote on last edited by
                  #8

                  Hi Kaushal, Did you get the solution for your problem? Basically, i am also having the same issue. I want to fix the word document page size and want to repeat the header and footer for every page. Actually i am exporting a gridview to the Word Document. Its all working fine without using the Word dll.But now to get the fixed page size of the word doc and pagination in the word ..like footer should display the page number am i really need the word.dll? and if you find the solution for your problem please let me know by a reply to this post. Thanks in advance.

                  1 Reply Last reply
                  0
                  • N Niks7755

                    Hello, I want to create word document using c#,now i did the task to create simple word document using word DLL. now my requirement is to make more automation on created word document through c# code,required automation as describe below... -> Define header and footer,footer contains page number,while header contains some text but i need that header change on odd and even pages,which is property of word "Different Odd & Event Pages". -> define the fix page size,and need to define margin from 4 different side. so please help me to short out my requirements. Thanks, Kaushal.

                    R Offline
                    R Offline
                    rlejason
                    wrote on last edited by
                    #9

                    Maybe you can try to use a c# word automation component to create word document and header,footer.Just like the Spire.Doc

                    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