Click here to Skip to main content
14,774,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to export html to word and for this I am telerik RadEditor control as html control. I am doing exporting process using Syncfusion and its work fine but when i export image it not display in word file i am using below code fot this can any one help me to solve this.

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;
                lblHtmlMessage.Text = "Conversion Successful";

                document.XHTMLValidateOption = XHTMLValidationType.Transitional;

                    document.Save("test.docx", FormatType.Word2010, Response, HttpContentDisposition.Attachment);
                catch { }

1 solution

jaideepsinh 19-Nov-13 23:50pm
Thanks for your response but i want to export HTML data in to Microsoft word document.
Azure Developer 20-Nov-13 2:19am
OpenXMLSdk has been created by Microsoft to Create Office Docs , So By Using OpenXMLSDK and the htmlto openxml dll you can convert html to MS Word File.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900