setting header/footer in word from ASP page

  • Thread starter Carolyn Speakman
  • Start date
C

Carolyn Speakman

C

Cindy M -WordMVP-

Hi =?Utf-8?B?Q2Fyb2x5biBTcGVha21hbg==?=,
is it possible to set the header and
footer on the word document being created?
Yes, it's possible, but the HTML code you'd need to write
would be much more complex than what the article shows. Go
into Word and create a very simple document ("Hello World"
in the body), with the header and footer you want. Now save
this as a web page (*.htm) and look at the result in a text
editor. You'll see Word's round-trip HTML. Most of the
stuff at the beginning (style lists, properties, etc.) you
won't need (same as you don't need it in the KB article
sample). But look carefully at how the header/footer
information is structured. Do some experimenting to find
out what/how much you can delete from this HTML file, and
still have Word open and display it successfully. When
you've narrowed it down, you know what your code has to
generate.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
C

Carolyn Speakman

That's been a great help, but I have another question.

I'm automatically making the user save the .doc file, instead of viewing it
in the web browser using VBScript:

<%
Response.AddHeader "Content-Disposition", "attachment;
filename=ClientReport.doc"
%>

However, after doing as you advised below, the header information is saved
in a separate file, which is not downloaded with the .doc file or even if the
file is shown in the browser as an .asp page and then saved.

Do you know how I can get the header page saved on the user's machine as well?

Thanks,
Carolyn
 
C

Cindy M -WordMVP-

Hi Carolyn,

Ah, my bad. You need to save as a "Single file web page" (=archive = *.mht file
format) to get it all into one file. This is even more complex, and it will only
work with more recent versions of Word (2002 and 2003 for sure; can't remember
for 2000; not at all for 97).

The other possibility, if only Word 2003 is concerned, is to use the new XML
file format.

The reason the header is being exported is because a web-page (in a browser)
doesn't use headers and footers, the same way as a printed document. Makes
sense, I just don't use HTML format much, so didn't remember about this.
That's been a great help, but I have another question.

I'm automatically making the user save the .doc file, instead of viewing it
in the web browser using VBScript:

<%
Response.AddHeader "Content-Disposition", "attachment;
filename=ClientReport.doc"
%>

However, after doing as you advised below, the header information is saved
in a separate file, which is not downloaded with the .doc file or even if the
file is shown in the browser as an .asp page and then saved.

Do you know how I can get the header page saved on the user's machine as well?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
C

Carolyn Speakman

Thanks very much, you've been a great help!

Cindy M -WordMVP- said:
Hi Carolyn,

Ah, my bad. You need to save as a "Single file web page" (=archive = *.mht file
format) to get it all into one file. This is even more complex, and it will only
work with more recent versions of Word (2002 and 2003 for sure; can't remember
for 2000; not at all for 97).

The other possibility, if only Word 2003 is concerned, is to use the new XML
file format.

The reason the header is being exported is because a web-page (in a browser)
doesn't use headers and footers, the same way as a printed document. Makes
sense, I just don't use HTML format much, so didn't remember about this.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top