07/14/10

Export ASP Classic ke Microsoft Word

Terkadang kita memerlukan web.. kita, perlu di Export ke Microsoft Word.
Buat file asp, yang script nya sebagai berikut:

<html>
<head>
<title>Transfer Data dari ASP Classic ke Word</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body >
<%
Response.ContentType = "application/vnd.ms-word"
%>
<table width="100%" border="1">

   <tr><td>No.</td><td>Nama</td> <td>Alamat</td> </tr>
   <%

        response.write "<tr><td>1</td><td>Akhmad</td><td>Surabaya</td><tr>"

        response.write "<tr><td>2</td><td>Anaqi</td><td>Surabaya</td><tr>"

        response.write "<tr><td>3</td><td>Naqibah</td><td>Jawa Timur</td><tr>"

    %>
</table>
<%
Response.Buffer = True
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader "content-disposition", "inline; filename = ASP_Word_Doc.doc"
%>
</body>
</html>

Postingan Lebih Baru Postingan Lama