We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export Image from HTML to Word

Thread ID:

Created:

Updated:

Platform:

Replies:

106177 Dec 14,2012 09:23 AM UTC Aug 22,2016 12:29 PM UTC ASP.NET Web Forms (Classic) 17
loading
Tags: DocIO
Dyana
Asked On December 14, 2012 09:23 AM UTC

I want to export some html code to word document. I am using paragraph.AppendHTML(htmlCode). But, when the html code include image tag, the image can't show in the document. Maybe it's because the image path on html code. 

Deivaselvan Y [Syncfusion]
Replied On December 17, 2012 12:37 PM UTC

Hi Dyana,

Thank you for your interest in Syncfusion products.

We have prepared the sample to illustrate your requirement to Append HTML tags into the word document using DocIO. Please do find the sample for the same from the attachment. Try running the sample and let us know if this helps you.

Please let us know if you have any other questions.

Regards,

Deiva selvan



Sample_89f105b0.zip

Dyana
Replied On December 18, 2012 04:40 AM UTC

thanks for your sample. Images can show clearly but it use original height and width. Can I adjust it? Because if the images has a large size, so it show too big in the word document.

Dyana
Replied On December 19, 2012 06:49 AM UTC

I had an html code (on attachment). I want to convert that html code into word document bookmark. But, I set the html code in string not in file html like :

string htmlCode = "<p>blablabla</p><table>......</table>.....";

I try to use paragraph.AppendHTML but the text between tag <p> show in bookmark and the rest show in the bottom of document. Can I show all in one bookmark? Please give me some advice. Thanks :) :)


test_3846b7ed.rar

Deivaselvan Y [Syncfusion]
Replied On December 24, 2012 09:06 AM UTC

Hi Dyana,

Thank you for your update

We have prepared a sample to illustrate your requirement to replace a BookMark with HTML formatted string into the word document using DocIO. Please do find the sample from the attachment and let us know if this helps you.

Please let us know if you have any other questions.

Regards,

Deiva selvan



Sample_2988c2c0.zip

Dyana
Replied On January 2, 2013 03:41 AM UTC

I see your sample, but code show how to convert html in html file. Like open the html file (test.html) and convert it to word bookmark. I want to convert html code without open the html file, because source of html I get from ckeditor not in html file. I save the code from ckeditor in string. So, i want convert it to word bookmark from string which have html code. Thanks :)

Deivaselvan Y [Syncfusion]
Replied On January 2, 2013 05:13 AM UTC

Hi Dyana,

Thank you for your update.

We have prepared a sample to illustrate your requirement to replace a Bookmark with HTML formatted string into the word document using DocIO. Please do find the sample from the attachment and let us know if this helps you.

Please let us know if you have any other questions.

Regards,
Deiva selvan



Sample_2e0c2c7d.zip

Dyana
Replied On January 2, 2013 07:49 AM UTC

Thanks for your help :)

Back to the image, I can convert it with html code to word bookmark, but it show with original size, whereas I already adjust height and width of image in html code. How can I adjust the size? Sorry, too many question that I made for you. Thanks for your attention. Thank you :)

Deivaselvan Y [Syncfusion]
Replied On January 3, 2013 01:24 PM UTC

Hi Dyana,

Thank you for your update.

We have prepared a sample to illustrate your requirement to set size of the image while Append the HTML formatted string into the word document using DocIO. Please do find the sample from the attachment and let us know if this helps you.

Please let us know if you have any other questions.

Regards,
Deiva selvan



Sample_d9f16ef0.zip

Ricardo Lapao
Replied On June 6, 2013 04:59 PM UTC

Hi,

I was trying to get the example ZIP file but I get a message with resource not found.

Thanks in advance,
Ricardo

Siva Subramanian [Syncfusion]
Replied On June 10, 2013 12:36 PM UTC

Hi Ricardo,

 

Sorry for the inconvenience.

 

Currently our servers are under maintenance, hence the sample that we updated in our last response could not be downloaded. We will let you know once the server maintenance process is completed. You may also check our website periodically for latest information regarding this.

 

Please let us know if you have any questions.

 

Regards,

Sivasubramanian


Sree Velicheti
Replied On November 13, 2013 02:05 PM UTC

Hello Guys,

I am facing same issue when exporting HTML content to Word document. Images are not getting displayed. I saw that you guys have prepared some sample application. But source code is not downloadable. can you please let me know when it will be available? Is it possible for you to send me that source code in email as this is urgent for me?

 

Thanks


Sathish K [Syncfusion]
Replied On November 18, 2013 05:58 PM UTC

Hi Sree,

Thank you for your update.

We have prepared a sample to illustrate your requirement to set size of the image while Append the HTML formatted string into the word document using DocIO. Please do find the sample from the attachment and let us know if this helps you.

Please let us know if you have any other questions.

Regards,
Sathish



GenerateWord_Windows_d42c18f.zip

Ashok Bhupathy
Replied On August 1, 2014 03:48 AM UTC

Hi,

I have the same problem, when converting a html file to word document, images are not displaying in the document,
I was trying to get the example ZIP file but I get a message with resource not found, and is it possible to extract images from html and keep that in a images folder and also  i want to convert that html file to xml, please provide us the solution.

Thanks in advance,
Ashok

Aneesh PS
Replied On October 8, 2015 07:03 AM UTC

Hi,

I have the same problem, when converting a html file to word document, images are not displaying in the document,
I was trying to get the example ZIP file but I get a message with resource not found, and is it possible to extract images from html and keep that in a images folder and also  i want to convert that html file to xml, please provide us the solution.

Thanks in advance,
Ashok

Hello Guys,


I am facing same issue when exporting HTML content to Word document. Images are not getting displayed. I saw that you guys have prepared some sample application. But source code is not downloadable. Can you please let me know when it will be available? Is it possible for you to send me that source code in email as this is urgent for me?

 

Thanks

Aneesh


Sathish K [Syncfusion]
Replied On October 8, 2015 12:36 PM UTC

Hi Aneesh,

Thank you for contacting Syncfusion support.

Regarding Image size setting while inserting XHTML string:
Kindly use the below code to resert the image size while inserting the XHTML string in Word document.

Code example:
string htmlString = "<html><body><img src='Imagepath' width='300' height='300'></img></body></html>";

secion.Body.InsertXHTML(htmlString);

If this doesn’t meet your requirement then kindly provide us your HTML string and input image file. Thereby we will investigate further on this issue and provide you the appropriate solution at the earliest.

Extracting images from HTML document:
Kindly use the below code to extract Images from a document and save to the disk.

Code example:
//Iterate paragraph items

foreach (ParagraphItem item in para.Items)

{

//Checks for WPicure instance

if (item is WPicture)

{

WPicture picture = item as WPicture;

//Loads the byte array into memory stream

MemoryStream stream = new MemoryStream(picture.ImageBytes);

//Loads the stream in Image

Image image = Image.FromStream(stream);

//Saves the image

image.Save(@"path");

}
}

Regarding HTML to XML conversion:
Could you please let us know which kind of XML file you are looking for? Whether Word document ML format XML or normal XML file? If you provide us your exact requirement then we will analyse further on this and provide you proper solution.

Regards,
Sathish


fighou
Replied On August 19, 2016 10:02 AM UTC

bro your attachment is not working

Vijay Ramachandran [Syncfusion]
Replied On August 22, 2016 12:29 PM UTC

Hi Fighou,

We regret the inconvenience.

We have fixed the issues found in the sample links, now you can download the samples from the corresponding links.

Regards,
Vijay R
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;