473,669 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4456
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.Applicatio n

// set seekview to PageHeader
objWord.ActiveW indow.ActivePan e.View.SeekView = wdSeekCurrentPa geHeader

// Find your bookmarks in the header/footer here and insert text accordingly
objWord.ActiveD ocument.Bookmar ks("HeaderClien tName").Select
objWord.Selecti on.TypeText Text:="ClientNa me"

// set seekview to Main Document
objWord.ActiveW indow.ActivePan e.View.SeekView = wdSeekMainDocum ent

// Find your bookmarks in the main document and insert text accordingly
objWord.ActiveD ocument.Bookmar ks("MainClientN ame").Select
objWord.Selecti on.TypeText Text:="ClientNa me"

"Vijay" <vi***@healthne ttech.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
1177
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 record created. The salesman name will be taken from a list of six possible salesman in strict order. i.e. salesman one for the first record, salesman two for
46
3834
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 I pass a recordset into this field? 2. How do I capture the return value?
4
3099
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 Response.Redirect("../somepage.htm") End If Else Response.Redirect("../somepage.htm") End If
27
3775
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 ported from VB3 to VB6, a job which took over two years. We would like to port it to Python, but we need to continue to offer upgrades and fixes to the current VB6 version. Does anybody know of ways we could go about rewriting this, one screen at a...
1
1058
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 suggestions on how to make it work with higher com port numbers? Thanks, Reuben
3
2301
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 Access 2000 are set at: VB for Applications MS Access 9.0 Object Library OLE Automation MS ActiveX DataObjects 2.5 Library MS VB for Apps Extensibility 5.3
3
2475
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 making stuff. Also, I would really like some tutorials, I want to learn more about VB
0
1477
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 Public oSheet As Excel.Worksheet Public path As String
4
1505
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 OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data & _ Source=" & Server.MapPath("~/App_Data/Lowes.mdb") & ";" & _ "Initial Catalog=Assets;Integrated Security=SSPI") Thanks!!
2
1073
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 statement but it only seems to work on the first line which I know has to do with my range but every change I make to the range screws up the spreadsheet. Any help would be appreciated. I am attaching the code below. Thanks, A Function...
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8382
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8802
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8586
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.