Asp.net, listbox, htc, behavior, autosearch listbox, wcf, certificate Html Export to word - Discoveries / Experiences in .Net Application development - Site Home - MSDN Blogs

Discoveries / Experiences in .Net Application development

Discoveries during Web Application development using Asp.Net, C# etc

Html Export to word

Html Export to word

  • Comments 1


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");

 }

 

Leave a Comment
  • Please add 1 and 7 and type the answer here:
  • Post