protected void btnExportToWord_Click(object sender, EventArgs e) { string strBody = "<html>" + "<body>" + "<div>Your name is: <b>om </b></div>" + "<table width=\"100%\" style=\"background-color:#cfcfcf;\"><tr><td>1st Cell body data</td><td>2nd cell body data</td></tr></table>" + "Ms Word document generated successfully." + "</body>" + "</html>"; string fileName = "MsWordSample.doc"; Response.AppendHeader("Content-Type", "application/msword"); Response.AppendHeader("Content-disposition", "attachment; filename=" + fileName); Response.Write(strBody); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)