본문 바로가기

기타

ASP 파일출력을 MS-Word로 출력하기

<%

Response.ContentType = "application/msword"

Response.AddHeader "Content-Disposition", "attachment;filename=receipt.doc"

Dim strName, strAddress

strName = Request.Form("Name")

strAddress = Request.Form("Address")

%>

<html>

<head>

<title>Word Test</title>

<style type="text/css">

.BigTitle {

font-family: Verdana, Sans-Serif;

font-size: 20pt;

font-weight: bold;

color: #004080;

}

.UserDetails {

font-family: Courier New, Monospace;

font-size: 12pt;

}

</style>
</head>
<body>
<p>
Word Output.
</p>
<p>
&nbsp;
</p>
<p>
Thank you for purchasing, your order will be shipped within 2 business
days. Below are the shipping details, provided by you.
</p>
<p>
<div align="left">
<table border="0" width="691" height="123" cellspacing="0" cellpadding="0">
<tr>
<td width="390" height="123" rowspan="3"></td>
<td width="90" height="33"><b>Name:</b></td>
<td width="201" height="33"><span class="UserDetails"><%=strName%></span></td>
</tr>
<tr>
<td width="90" height="28"><b>Address:</b></td>
<td width="201" height="28"><span class="UserDetails"><%=strAddress%></span></td>
</tr>
<tr>
<td width="90" height="62"></td>
<td width="201" height="62"></td>
</tr>
</table>
</div>
</body>
</html>

===================

<a href="edu_sinchung_view.asp?ContentType=application/msword" border=0><img src="MakeWord.jpg" border=0></a>
<a href="edu_sinchung_view.asp?ContentType=application/vnd.ms-powerpoint" border=0><img src="MakePowerPoint.jpg" border=0></a>
Response.ContentType = "application/vnd.ms-excel; name='My_Excel'"
Response.AddHeader "Content-Disposition","attachment;filename=subject_sin_excel.xls"