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. Image for the cookie policy date
close icon

Export Image from HTML to Word

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. 

17 Replies

DY Deivaselvan Y Syncfusion Team 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


DY Dyana 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.


DY Dyana 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


DY Deivaselvan Y Syncfusion Team 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


DY Dyana 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 :)


DY Deivaselvan Y Syncfusion Team 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


DY Dyana 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 :)


DY Deivaselvan Y Syncfusion Team 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


BL Bruno lopes 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


SS Siva Subramanian Syncfusion Team 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



SV Sree Velicheti 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



SK Sathish K Syncfusion Team 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


AB Ashok Bhupathy 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


AP Aneesh PS replied to Ashok Bhupathy 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



SK Sathish K Syncfusion Team 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



FI fighou August 19, 2016 10:02 AM UTC

bro your attachment is not working


VR Vijay Ramachandran Syncfusion Team 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
 


Loader.
Live Chat Icon For mobile
Up arrow icon