Jump to content

ASP and Microsoft Word


celfyn

Recommended Posts

Hello,I have created an asp page which creates a Word document on the fly. It uses several stored procedures to retrieve the relevant information from the database. Everything works fine, except for the header and footers. Does anyone know how would I write something to the headers and footers from the asp page? Here is the code I use to generate the Word document: Response.ContentType = "application/msword" Response.AddHeader "Content-Disposition", "attachment;filename=Filenamedoc"To write to the document I simply use Response.Write.All the styling is handled by CSS.Thanks!

Link to comment
Share on other sites

Are you just writing normal text or HTML code? Normally a .doc file is a binary format, you wouldn't be able to send ASCII text and have Word not crash when it tries to open it. Maybe sending the content type header just tells the browser to send the file to Word and maybe Word looks at the file and figures out if it's HTML or something. When I have created documents for Word I've always used the RTF format, which is an ASCII format, although a needlessly complex one.If you're just sending HTML or plain text as a word document you wouldn't be able to use Word features like headers and footers, track changes, etc. If you want to use those features you'll need to use the native .doc format, so you will probably need to buy a component that can create Word files. Microsoft doesn't give out their specs and file formats for free, and most ASP developers don't develop free components. People developing in an environment that requires licensing usually develop products that require licensing also.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...