I'm trying to generate a Word document using Spire.Doc and download it. I can download the document, but it is empty. Does anyone have any idea why that is and can help me? This is my code:
Document doc = new Document();
Paragraph paragraph = doc.AddSection().AddParagraph();
paragraph.AppendText("Hello World!");
doc.SaveToFile("Example.doc", FileFormat.Doc);
//Saves the Word document to MemoryStream
MemoryStream stream = new MemoryStream();
stream.Position = 0;
//Download Word document in the browser
return File(stream, "application/msword", "Example.doc");
Here is a working example using .NET Core 3.1 and FreeSpire.Doc v9.9.7
You may also need the following using statements, but I'm presuming you already have them.