[英]WPF add html string to HTML file and save it
我有WPF应用程序,它具有如下HTML字符串。 我如何基于此字符串创建一个新的HTML文件,并将此文件保存在我的应用程序文件夹中的背后代码中?
string str = "<h2><u>TEST</u></h2><div style='margin:0 auto;'>";
你可以做这样的事情
using (FileStream fs = new FileStream("document.html", FileMode.Create))
{
using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
{
sw.WriteLine("<h2><u>TEST</u></h2><div style='margin:0 auto;'>");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.