Creating MS Word documents in ASP
I have the following code which works and writes to a simple word temaplate. However, I want to:
1) use a specific template to acheive this, and
2) would like to ensure the content appears in a specific position
The solution to 1 will be good enough.
Thanks in advance.
<%
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition", "attachment;filename=quotes.doc"
dim quoteTable
quoteTable="<table cellpadding='1' cellspacing='0' wisth='100%'><tr><td colspan='5'><h3 style='padding-left:10px;'>Existing quotes</h3></td></tr>"
quoteTable=quoteTable & "<tr bgcolor='#ADCCE4'><td class='right_text'><strong>Date of quote</strong></td>"
quoteTable=quoteTable & "<td class='right_text'><strong>Quote</strong></td>"
quoteTable=quoteTable & "<td class='right_text'><strong>Item</strong></td>"
quoteTable=quoteTable & "<td class='right_text'><strong>Cost</strong></td>"
quoteTable=quoteTable & "<tr><td class='right_text'>Date of quote</td>"
quoteTable=quoteTable & "<td class='right_text'>£1500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>Item</td>"
quoteTable=quoteTable & "<td class='right_text'>£1500.00</td>"
quoteTable=quoteTable & "<tr><td class='right_text'>Date of quote</td>"
quoteTable=quoteTable & "<td class='right_text'>£1500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>Item</td>"
quoteTable=quoteTable & "<td class='right_text'>£1500.00</td>"
quoteTable=quoteTable & "<tr><td class='right_text'>Date of quote</td>"
quoteTable=quoteTable & "<td class='right_text'>£1500.00</td>"
quoteTable=quoteTable & "<td class='right_text'>Item</td>"
quoteTable=quoteTable & "<td class='right_text'>£1500.00</td>"
quoteTable=quoteTable & "<tr><td class='right_text' colspan='4'> </td></tr>"
quoteTable=quoteTable & "<tr><td class='right_text'><strong>Totals</strong></td>"
quoteTable=quoteTable & "<td class='right_text'>£4500.00</td>"
quoteTable=quoteTable & "<td class='right_text'> </td>"
quoteTable=quoteTable & "<td class='right_text'>£4500.00</td>"
quoteTable=quoteTable & "<td class='right_text'> </td></tr>"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</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;
}
.right_text {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
line-height: 15px;
padding-left: 10px;
}
</style>
</head>
<body>
<span class="BigTitle">Quotes</span>
<span class="UserDetails"><%=quoteTable%></span>
</body>
</html>
|