Hi there, I am trying to create a document from an HTML source. Once the document is created, I want to send the document to the client’s browser. I don’t want to have to save it to the server.
I am just trying to get a basic sample working. However, when the file downloads it says it is empty. I also attached an image of what the file looks like when it tries to download to the Chrome browser.
Here is the code:
//Create a new document
Document doc = new Document();
//Create a document builder to begin building the document
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(“
Test HTML
”); doc.Save(HttpContext.Current.Response, “ReportOut.docx”, ContentDisposition.Inline, Aspose.Words.Saving.SaveOptions.CreateSaveOptions(SaveFormat.Docx));