Hi sanisam640,
Read the text from the editor and append to generate a html.
Finally export the html to word document.
Refer below sample code.
HTML
I have used TinyMCE editor for reading the HTML.
For more details on using TinyMCE, please refer the following article.
Using Tiny MCE Rich TextBox in ASP.Net
<asp:TextBox ID="txtTinyMCE" runat="server" TextMode="MultiLine"></asp:TextBox>
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="OnExport" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.0.20/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({ selector: 'textarea', width: 300 });
</script>
Code
C#
protected void OnExport(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<html>");
sb.Append("<head>");
sb.Append(" <title></title>");
sb.Append("</head>");
sb.Append("<body>");
sb.Append(txtTinyMCE.Text);
sb.Append("</body>");
sb.Append("</html>");
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=TimyMCE.doc");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-word ";
Response.Output.Write(sb.ToString());
Response.Flush();
Response.End();
}
VB.Net
Protected Sub OnExport(sender As Object, e As EventArgs)
Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder()
sb.Append("<html>")
sb.Append("<head>")
sb.Append(" <title></title>")
sb.Append("</head>")
sb.Append("<body>")
sb.Append(txtTinyMCE.Text)
sb.Append("</body>")
sb.Append("</html>")
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment;filename=TimyMCE.doc")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-word "
Response.Output.Write(sb.ToString())
Response.Flush()
Response.End()
End Sub
Screenshots
The Form
Generated Word Document