/// <summary>
///生成html文件
/// </summary>
/// <param name="News_ID">生成ID</param>
/// <param name="Format">替换字符数组</param>
/// <param name="Htm_Path">生成Htm的路径</param>
/// <param name="Templet_Name">模板名称</param>
/// <param name="page">页面</param>
/// <returns></returns>
public bool WriteHtmlFile(string News_ID,string [] Format,string Htm_Path,string Templet_Value,Page page)
{
string path = HttpContext.Current.Server.MapPath(Htm_Path+"/");
if(!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
string htmlfilename=News_ID+".htm";
string sql = "select Stencil from Stencil where Compositor='"+Templet_Value+"'";
StringBuilder htmltext=new StringBuilder(this.ExecuteScalar_return_String(sql));
for(int i=0;i<Format.Length;i++)
{
htmltext.Replace("$htmlformat["+i+"]",Format[i]);
}
try
{
using(StreamWriter sw=new StreamWriter(path + htmlfilename,false,System.Text.Encoding.GetEncoding("GB2312")))
{
sw.WriteLine(htmltext);
sw.Flush();
sw.Close();
return true;
}
}
catch
{
return false;
}
}