0

I am trying to output my console application to a webpage, the console application generates a set of double/decimal and string arrays which are displayed. Can anybody help me output it to a html file please.

This is the code I have so far:

if (!File.Exists("Test.html"))
                    {
                        StreamWriter stream = new StreamWriter("Test.html", true, System.Text.Encoding.UTF8);
                        stream.Write(@"<html>" + stream.NewLine + @"<body>" + stream.NewLine);
                        stream.Write(@"<table width='100%' cellpadding='10' style='margin-top:10px' cellspacing='3' border='1' rules='all'>
                        <tr>
                        <td>
                        <h3>
                        <span style='font-family:Verdana'>"+stock1+" My Test Is here</span>
                        </td>
                        </tr>
                        </table>" + stream.NewLine + "</body>" + stream.NewLine + "</html>");
                        stream.Flush();
                        stream.Close();
                    }
                    System.Diagnostics.Process.Start(@"Test.html");

I am not really sure how this snippet of code works but before adding "+stock1+" it outputted the text 'My Test Is Here'. Thank you in advance.

  • Consider using HtmlAgilityPack or some other HTML DOM library to construct HTML. Properly encoding values is generally harder than using existing library. – Alexei Levenkov Apr 23 '15 at 01:24
  • If your problem is not syntax error in the code make sure to edit your post with complete error information so question may be reopened. – Alexei Levenkov Apr 23 '15 at 01:24

0 Answers0