So continuing from my exporting sample series here I am narrating how to export data to HTML file in C#, ASP.Net. For this example I’ll use same “ GetData ” method (to get the data for exporting) which we had used in Export to Excel example, you can use your own method to get data. /// <summary> /// Export to Html /// </summary> public static void ExportHtmlFile() { const string format = "<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>" ; var sb = new StringBuilder (); sb.AppendFormat( "<h1 style='font-size: 18px;font-weight: bold;'>{0}</h1>" , "Export HTML Sample" ); sb.Append( "<table style='width:500px;'>" ); sb.AppendFormat(format , "First Name" , "Last Name" , "Email Address"
Comments
Post a Comment