473,394 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
Nov 15 '05 #1
2 7626
Cemil Örüm wrote:

Hi Cemil,
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.


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/

Nov 15 '05 #2
Well I found an example for VB:
ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Range.InsertAfter
"My Text"

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

Cemil

"Michael Kremser" <NO************@i-one.at> schrieb im Newsbeitrag
news:eL*************@TK2MSFTNGP11.phx.gbl...
Cemil Örüm wrote:

Hi Cemil,
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.


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/

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rupe | last post by:
Hi CSS gurus! I have an embarassing problem. I am a php programmer and I try to expound the advantages of css on the php newsgroups. However, after telling someone that they should use css...
28
by: reneecccwest | last post by:
hello, how can I remove IE headers and footers when I print a page? I'd like to use a code to remove them, not thru the IE page setup. s/RC
2
by: PerryC | last post by:
Is there a way to export an MS Access Report to Word/Excel that looks EXACTLY like it appears in Access? When I export to Excel, only certain data appears, titles, headings... all missing. The...
1
by: Kenneth | last post by:
Hi, In IE6 you can configure output to the printer getting a clean printout only with content, but without headers and footers. You remove the Header and Footer content from the Page Setup. But...
3
by: Adam Faulkner via DotNetMonster.com | last post by:
I want to create a method within a class that opens a Microsoft Word 2000 Document and has the facility to Create a new word document and then extract a Page that exists within the original Word...
4
by: enak | last post by:
I need to open a Word template so that I can merge some data from a database with the document. I am using ASP.NET, VB.NET. I can not even get MS Word to be visible. I can see that an instance is...
0
by: steve | last post by:
I am looking for a way to create dynamic headers and footers in a web form. There are .Net PDF products that convert web form content into PDF format and insert dynamic headers/footers. I'm...
0
Gyanchand
by: Gyanchand | last post by:
Actually we need to use a Word template and insert cetain values through ASP. What I have done currently is : Have created a page in HTML and written the HTML to a text file and saved it as an doc...
0
by: Julia1 | last post by:
Actually I have encountered several problems working with Word. Please see if you can help me resolve them. My application creates documents (Microsoft.Interop.Word.Document) each one according...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.