Partager via


Html Export to word

Html Export to word

just call this function in the code sample from any aspx page say on export to word button click..

u see the html page contents rendered in a msword format.

// For Direct Exporting From  HTML to Word
  // Call this function on Button Click , pls include the required system.web namespaces
 public static void HtmlExportToWord()

 {
 
  HttpContext.Current.Response.Buffer = true;
  HttpContext.Current.Response.ContentType = "application/vnd-ms.word";

///uncomment the 1st  line if you want to open directly in IE and comment the 2nd  line
  //HttpContext.Current.Response.AddHeader("content-disposition", "inline; filename=ExportWord.doc");
  HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=ExportWord.doc");

 }

Comments