我有一个html页面,我将文件读取为字符串并从数据库中动态替换内容,如下所示
try
{
FileStream fs = new FileStream(Server.MapPath("~/QuotationFormat.htm"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
StreamReader sr = new StreamReader(fs);
result = sr.ReadToEnd();
sr.Close();
sr.Dispose();
fs.Dispose();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
result = result.Replace("<quotationno>", _list[0].quotation_no);
现在更换内容后,我想将html文件下载为带有页码和分页符的word文档(因为它有大量内容)。我怎样才能做到这一点?我的html文件就像这样
<table class="info-table">
<tr>
<td style="width:65%;">
<p>
To
</p>
<h2><clientname></clientname></h2>
<p>
<clientaddress></clientaddress>
</p>
</td>
<td>
<h2>Quotation</h2>
<p>
Quotation No: <quotationno></quotationno> <br />
Date: <quotationdate></quotationdate>
</p>
<p>
Your Reference: <clientrefname></clientrefname> <br />
Date: <referencedate></referencedate>
</p>
</td>
</tr>
</table>