Hello,
I have a code block which converts HTML data to DOCX file using aspose. The entire html is being rendered in the doc. But it being truncated. Means the html design is not wrapping up inside a page properly.
Please find the attached files for better understanding my issue.
Code used to convert:
public static void DownloadDoc(string ResponseString, string DownloadDocName)
{
License license = new License();
license.SetLicense("Aspose.Words.lic");
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(ResponseString);
MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.Docx);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + DownloadDocName.Trim().Replace(" ", "") + "" + DateTime.Now.ToShortDateString().Replace("/", "_") + ".docx");
HttpContext.Current.Response.ContentType = "application/vnd.ms-word";
HttpContext.Current.Response.BinaryWrite(stream.ToArray());
HttpContext.Current.Response.End();
}
Waiting for your response.
Thank You.