14 בJanuary 2016
Sometimes on server side we need to draw some reports to our domain folder,
If we already inside dotnet area we can simplify the process with simple dotnet framework.
Using HtmlTextWriter can do the work and very easily , just assume that you know something or two about html, and the hierarchical structure of it, than you can continue from this struct to develop any webpage you need, start html tag , header body etc, of course can insert any css or js references,
Just do not forget to close any opened tags, so as a demo :
private static string lines = new string;
using (StreamWriter Swriter = new StreamWriter("c://newHtml.html"))
using (HtmlTextWriter writer = new HtmlTextWriter(Swriter))
// <head Tag>
// <body Tag>
// </div Tag>
// Loop over some strings data.
foreach (var line in lines)
// Begin Pre Tag
// End Pre Tag
And that it !!
Again remember, unlike HTML here every closing Tag is mandatory.