62,243
社区成员




/// <summary>
/// 写入文件
/// </summary>
/// <param name="Path">文件路径</param>
/// <param name="Text">写入内容</param>
/// <param name="Coding">文件编码</param>
public static void Writer(string Path, string Text, string Coding)
{
if (File.Exists(Path))
{
Delete(Path);
}
try
{
sw = new StreamWriter(Path, false, Encoding.GetEncoding(Coding));
sw.WriteLine(Text);
sw.Flush();
sw.Close();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
}
三个参数中路径是物理路径
比如你要生成word文档
就写d:/aaa.doc
要写入的内容
就是你要保存的html标签
编码格式就是字符编码,可以是GB2312或者是utf-8