string errorMessage = ""; IWParagraph para; WordDocument document = new WordDocument(); IWSection section; protected void Export_Click(object sender, EventArgs e) { section = document.AddSection(); para = section.AddParagraph(); string htmlText = txtBody.Content; bool valid = section.Body.IsValidXHTML(htmlText, XHTMLValidationType.Transitional, out errorMessage); if (!valid) { lblHtmlMessage.Text = "Content is not a well formatted XHTML content \nError message:\n" + errorMessage; } else { lblHtmlMessage.Text = "Conversion Successful"; document.XHTMLValidateOption = XHTMLValidationType.Transitional; section.Body.InsertXHTML(htmlText); try { document.Save("test.docx", FormatType.Word2010, Response, HttpContentDisposition.Attachment); } catch { } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)