469,945 Members | 2,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

Problem with writing ms-word hheader through ASP.NET(VB.NET)

Hi,

I have to generate a word or rtf file on the fly whould
have a Header and footer both but i m not able to include
the header and footer in the document can anyone suggest
me how can i do that.
Currrently i am having a template of word document which
has a header ad footer and in that i m having tags which i
m replacing with my data.But when i m genrating the
document its not including the header and footer in the
document.How can i do that.
Any suggestion or example given willl be highly
appreicated.

thaanks
vijay
Nov 17 '05 #1
1 4335
Vijay,

I've done this using bookmarks, the code below is written using VB6 but the
references to the Ms-Word object should work in dotnet as well !!

Hope this helps

Jurjen de Groot,
G.I.T.S. Netherlands.
Dim objWord as Object
Set objWord = new Word.Application

// set seekview to PageHeader
objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader

// Find your bookmarks in the header/footer here and insert text accordingly
objWord.ActiveDocument.Bookmarks("HeaderClientName ").Select
objWord.Selection.TypeText Text:="ClientName"

// set seekview to Main Document
objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

// Find your bookmarks in the main document and insert text accordingly
objWord.ActiveDocument.Bookmarks("MainClientName") .Select
objWord.Selection.TypeText Text:="ClientName"

"Vijay" <vi***@healthnettech.com> wrote in message
news:0d****************************@phx.gbl...
Hi,

I have to generate a word or rtf file on the fly whould
have a Header and footer both but i m not able to include
the header and footer in the document can anyone suggest
me how can i do that.
Currrently i am having a template of word document which
has a header ad footer and in that i m having tags which i
m replacing with my data.But when i m genrating the
document its not including the header and footer in the
document.How can i do that.
Any suggestion or example given willl be highly
appreicated.

thaanks
vijay

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by garyusenet | last post: by
46 posts views Thread by Adam Turner via AccessMonster.com | last post: by
4 posts views Thread by George | last post: by
27 posts views Thread by Josh | last post: by
1 post views Thread by reubenwilcock | last post: by
4 posts views Thread by slinky | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.