convert .aspx to .doc maintain header footer positions

JS List
JS List used Ask the Experts™
on
convert .aspx to .doc maintain header footer positions
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017

Commented:
Please explain what you are trying to do, aspx is a web based

Not sure I get what you want, print to PDF will preserve the results ...

Author

Commented:
I have a web page, .aspx, that looks like a report.  The page has a header and footer.  The page has report data, pulled from a database, which fills part of the page.  The report data does not fill the entire page.   When I do a print preview, using the printer drivers, the footer & header are in the correct area.  

To make the report produce a word file, .doc, I use this:
<%Response.AddHeader("Content-Disposition", "Attachment;Filename=" & thisFile & "_Training.doc")
    Response.ContentType = "application/vnd.ms-word"%>

When I produce the word doc the header is at the top but the footer jumps up to where the last paragraph is at.  The footer doesn't display at the bottom.  
I've used CSS - encompass the whole document in a <div> then have 3 sub <div>s - Header Body Footer.  But doesn't work.
Any ideas?
Distinguished Expert 2017

Commented:
Look at the page setup for margins, use print to pdf
If you want it in word format, simply designating content type would not do it. Look at whether you can use the conversion before outputing the results.
Ryan ChongSoftware Team Lead

Commented:
as what I thought, you should create a Word Document Template directly and use it to fill in the details

A direct conversion from aspx to doc won't give you much flexibility and nice layout.
Commented:
I ended up using this:

Response.AddHeader("Content-Disposition", "Attachment;Filename=" & thisFileNumber & "_report.doc")
    Response.ContentType = "application/vnd.ms-word"

It allows the user to add additional rows if it's not spaced correctly.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial