string sql = "select top 1 Documentbody from Annotation where ObjectId like '%" + thePrintTempalteGuid.ToString() + "%' and MimeType like '%htm%' order by CreatedOn desc";
DataTable theAnnotation = new BaseSql().ExecuteReturnDataTable(sql);
if (theAnnotation.Rows.Count < 1)
{
ClientScript.RegisterStartupScript(this.GetType(), "nofile", "<script>alert('没有在打印模板中找到指定的模板,请将模板文件以附件形式上传到打印模板!');top.close();</script>");
return;
}
byte[] theHtmlFile = Convert.FromBase64String(theAnnotation.Rows[0]["DocumentBody"].ToString());
MemoryStream stream = new MemoryStream(theHtmlFile, 0, theHtmlFile.Length);
//从内存流里面将文件内容读出来
StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
string theFileContext = reader.ReadToEnd();