Word Headers/Footers in C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cemil Örüm

    Word Headers/Footers in C#

    Hello,

    can anybody tell me, how I can change the header and the footer of a
    word-document with c# ?
    I already know, how to open word and how to create a document and paste text
    into it, but I cannot access the header/footer.

    Thanks for your help,

    Cemil


  • Michael Kremser

    #2
    Re: Word Headers/Footers in C#

    Cemil Örüm wrote:

    Hi Cemil,
    [color=blue]
    > can anybody tell me, how I can change the header and the footer of a
    > word-document with c# ?
    > I already know, how to open word and how to create a document and paste text
    > into it, but I cannot access the header/footer.[/color]

    Try to record a VBA Macro and then analyse the source code Excel
    creates. It should be similar to the code you have to write in your C#
    program.

    HTH,

    Michael

    --
    Michael Kremser


    Comment

    • Cemil Örüm

      #3
      Re: Word Headers/Footers in C#

      Well I found an example for VB:
      ActiveDocument. Sections(1).Hea ders(wdHeaderFo oterPrimary).Ra nge.InsertAfter
      "My Text"

      But C# does not know 'wdHeaderFooter Primary'. How can I do that in C# ?

      Cemil

      "Michael Kremser" <NOSPAM_michi-k@i-one.at> schrieb im Newsbeitrag
      news:eLCynHidDH A.904@TK2MSFTNG P11.phx.gbl...[color=blue]
      > Cemil Örüm wrote:
      >
      > Hi Cemil,
      >[color=green]
      > > can anybody tell me, how I can change the header and the footer of a
      > > word-document with c# ?
      > > I already know, how to open word and how to create a document and paste[/color][/color]
      text[color=blue][color=green]
      > > into it, but I cannot access the header/footer.[/color]
      >
      > Try to record a VBA Macro and then analyse the source code Excel
      > creates. It should be similar to the code you have to write in your C#
      > program.
      >
      > HTH,
      >
      > Michael
      >
      > --
      > Michael Kremser
      > http://great.dynu.com/
      >[/color]


      Comment

      Working...