Word has a lot of ways to build Word documents on the Web, and the most common approach is to use Word to generate. dot documents, and then pass macros to the. dot document using ASP, which is good, but complex to implement, and cannot iterate through the tables.
In the practical application, I summed up a new Word file generation method, the generated Word file has a header, page angle, now take out an example and discuss with you.
Realize:
My solution is to use Word XP (which has not been tried in other versions) to make a table, convert a good Word table into an HTML document, and control the converted HTML document with ASP.
A header, page corner solution, after converting a doc document with Word headers and corners, appends a folder to the converted HTML file, with a header, page corner file, and picture, as long as the path to the HTML file is changed to the server path. After the user opens and ASP-generated Word files, Word automatically prompts to save the files.
Look at the following Word converted HTML text, I use ASP to simple control:
<% Response.ContentType = "Application/msword"%>
<!--#include file= "inc/conn_open.asp"-->
<!--#include file= "inc/transition.asp"-->
<!--#include file= "inc/check_character.asp"-->
<!--#include file= "inc/errormsg.asp"-->
<!--#include file= "inc/check_privilege.asp"-->
<!--#include file= "inc/check_logout.asp"-->
<!--#include file= "inc/system_log_action.asp"-->
<%response.buffer=false
Response.expires=0
Call Check_logout ()
Call Check_state ()
Call Privilege (6)
Call Log_action ("Access", "Sales number Printing", "Print temporary sales number" &request ("temp_id"), 1)%>
%>
xmlns:o= "Urn:schemas-microsoft-com:office:office"
xmlns:w= "Urn:schemas-microsoft-com:office:word"
xmlns= "HTTP://WWW.W3.ORG/TR/REC-HTML40";>
<meta http-equiv=content-type content= "text/html; charset=gb2312 ">
<meta Name=progid content=word.document>
<meta name=generator content= "Microsoft Word >"
<meta name=originator content= "Microsoft Word >"
<link rel=file-list href= "Create_doc/filelist.xml" >
<link rel=edit-time-data href= "Create_doc/editdata.mso" >
<link rel=ole-object-data href= "Create_doc/oledata.mso" >
<!--[if GTE MSO 9]><xml>
<o:DocumentProperties>
<o:Author>Administrator</o:Author>
<o:LastAuthor>Administrator</o:LastAuthor>
<o:Revision>34</o:Revision>
<o:TotalTime>26</o:TotalTime>
<o:LastPrinted>2002-11-06T05:54:00Z</o:LastPrinted>
<o:Created>2002-11-06T04:56:00Z</o:Created>
<o:LastSaved>2002-11-06T05:55:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Words>98</o:Words>
<o:Characters>562</o:Characters>
<o:Company>shine</o:Company>
<o:Lines>4</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:CharactersWithSpaces>659</o:CharactersWithSpaces>
<o:Version>10.2625</o:Version>
</o:DocumentProperties>
</xml><! [endif]--><!--[if GTE MSO 9]><xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:Compatibility>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><! [endif]-->
<style>
<!--
/* Font Definitions * *
@font-face
{font-family: Song body;
Panose-1:2 1 6 0 3 1 1 1 1 1;
Mso-font-alt:simsun;
mso-font-charset:134;
Mso-generic-font-family:auto;
mso-font-pitch:variable;
Mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family: "\@ song Body";
Panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
Mso-generic-font-family:auto;
mso-font-pitch:variable;
Mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions * *
P.msonormal, Li. MsoNormal, Div. MsoNormal
{mso-style-parent: "";
margin:0cm;
margin-bottom:.0001pt;
Mso-pagination:widow-orphan;
font-size:12.0pt;
Font-family: Song body;
Mso-bidi-font-family: Song body;
P.msoheader, Li. Msoheader, Div. Msoheader
{margin:0cm;
margin-bottom:.0001pt;
Text-align:center;
Mso-pagination:widow-orphan;
Tab-stops:center 207.65pt right 415.3pt;
Layout-grid-mode:char;
Border:none;
Mso-border-bottom-alt:solid windowtext 75pt;
padding:0cm;
mso-padding-alt:0cm 0cm 1.0pt 0cm;
font-size:9.0pt;
Font-family: Song body;
Mso-bidi-font-family: Song body;
P.msofooter, Li. Msofooter, Div. M