Another way of generating a Word document

zhaozj2021-02-16  47

On the Internet, the method of generating a Word document using the ASP is a lot. The most common method is to use Word to generate .dot documents, then transfer macro in the .dot document, this method is good, but it is very complicated And you cannot loop the form.

In practical applications, I summed up a new way to generate a Word file. The generated Word file has header, page corner, and now take out an example of discussing.

achieve:

My solution, use Word XP (other versions have not been tried yet) to create a form, convert the Word table to an HTML document, and the HTML document is converted with ASP.

The header, the page corner solution, after the conversion of the Word header, the DOC documentation of the page is attached to the converted HTML file, there is a header, page corner file and picture, as long as the corresponding in the HTML file The location changes its path to the server path. After the user opens the Word file generated by the ASP, Word will automatically prompt for these files.

Look at the HTML text after the following Word conversion, I use ASP to simply control:

<% Response.contenttype = "Application / MSWORD"%> < ! - #include file = "inc / check_character.asp" -> <% response.buffer = falseresponse.expires = 0call Check_logout () CALL CHECK_STATE () CALL PRIVILEGE (6) Call Log_Action ("Access", "Sales Number Print", "Print Temporary Sales Number" & Request ("Temp_ID"), 1)%>%> >>>>>>>>

administrator Administrator 34 26 2002-11-06T05: 54: 00Z 2002-11-06T04: 56: 00z 2002-11-06T05: 55: 00Z 1 < / O: Pages> 98 562 Shine 4 1 659 10.2625 < ! [Endif] -> < ! - [IF GTE MSO 9]> Print Clean Clean MicrosoftInterneTexplorer4 <

/ xml>