Reputation: 387
i have WPF application which have an HTML string as below. how can i creeate a new HTML file base on this string and save this file in my application folder in code behind?
string str = "<h2><u>TEST</u></h2><div style='margin:0 auto;'>";
Upvotes: 0
Views: 844
Reputation: 7556
you can do something like this
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;'>");
}
}
Upvotes: 1