473,320 Members | 1,859 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,320 software developers and data experts.

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 4437
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: garyusenet | last post by:
I'm using MS VB Express Ed. 2005. I have an sql database. This database has one table, and there is a column called salesman. I want to AUTOMATICALLY enter the salesman name for every new...
46
by: Adam Turner via AccessMonster.com | last post by:
If I had a field called "Name" in an Access table "Contact Info", and the field contained VBScript... Function Main(rstFields) Main = rstFields.Item("FirstName").Value End Function 1. How do...
4
by: George | last post by:
I am trying to check whether a query string is being passed to my .aspx page, like so: If Not Request.QueryString Is Nothing Then If CInt(Request.QueryString.GetValues("values")(0)) <> 1 Then...
27
by: Josh | last post by:
We have a program written in VB6 (over 100,000 lines of code and 230 UI screens) that we want to get out of VB and into a better language. The program is over 10 years old and has already been...
1
by: reubenwilcock | last post by:
Hi all, I have been using the 'COM Port Sample' which is provided with MS VB 2005 Express Edition (RS232.vb), and I only seem to be able to get it to function with com ports up to COM9. Any...
3
by: Photobug | last post by:
I have downloaded Allen Browne's function TableInfo() and am getting a ByRef Type Mismatch error when I try to execute it. I don't know if it is a reference problem or not, but my references for...
3
by: alexcole | last post by:
I use Microsoft Visual Basic 2005 Express edition, and i do not know how to change my projects into .exe files. Or I can take suggestions to make one, I really just started today, and I'm already...
0
by: saaprasad2002 | last post by:
i opened an excel application using follwing code to load test data to run mstest cases Public Class ExcelMatrixReader Public oXL As Excel.Application Public oWB As Excel.Workbook ...
4
by: slinky | last post by:
I'm making a OLE DB connection in code and was wondering if anyone could identify what the syntax errors I have. I've tried countless combinations and all give errors. New...
2
by: Andreak14 | last post by:
Hi, I have an excel spreadsheet that populates columns based on a user's input. I was previously handling this with If statements in excel but have hit the nesting limitation so I wrote a Case...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.