using (WordDocument document = new WordDocument()) { IWSection section = document.AddSection(); IWParagraph paragraph = section.AddParagraph(); paragraph.AppendText(" Add Further instructions"); document.Save(NameOfTemplate + ".docx", FormatType.Docx, System.Web.HttpContext.Current.Response, HttpContentDisposition.Attachment); document.Close(); }
document.Save(NameOfTemplate + ".docx", FormatType.Docx, System.Web.HttpContext.Current.Response, HttpContentDisposition.Attachment);
System.Web.HttpContext.Current.Response
@{Html.BeginForm("GenerateTemplate", "IndividualMatterCreateDocument", FormMethod.Get);
document.Save("TestDocument.docx", FormatType.Docx, HttpContext.ApplicationInstance.Response, HttpContentDisposition.Attachment);
document.Save(@"C:\Test.docx", FormatType.Docx);
|
//Download Word document in the browser return File(stream, "application/msword", "Sample.docx"); |