Featured

How to create word using Free Spire.Doc for .NET

Last modified: March 27, 2022
Step 1

Create an ASP.NET Web Form application.

Step 2

Install Free Spire.XLS Nuget package. nuget

Step 3

public IActionResult Index() { var doc = new Document(); var section = doc.AddSection(); var Para = section.AddParagraph(); Para.AppendText("aaa"); var ms = new MemoryStream(); var contentType = "application/msword"; doc.SaveToStream(ms, Spire.Doc.FileFormat.Doc); ms.Position = 0; var fileName = "demo.docx"; doc.SaveToFile(@"C:\Temp\Sample.doc", FileFormat.Doc); //save to local drive return File(ms, contentType, fileName); //download file }