We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

InsertHTML w/ images?

I’m trying to enable people to enter text into an html editing window and have the information, including images, saved to word. DOes aspose.words allow this? If not, are there any plans for it to in the near future?

This message was posted using Aspose.Live 2 Forum


Thank you for your interest in Aspose.Words. Yes, Aspose.Words allow convert HTML to word document. You can use the following code.

Document doc = new Document("in.html");
doc.Save("out.doc", SaveFormat.Doc);

Also you can insert html into the document (including pictures).

//Create document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
//Create HTML string
string someHtml = "<img src='http://images.amazon.com/images/G/03/videogames/features/TestDrive_PC_big_2.jpg' border='0' />";
//Insert HTML
//Save document

I hope this could help you.


That worked great. The one issue I’m encountering is that it will take external URLs but when I’m testing locally the page is at http://localhost/… and if I enter that, it can’t find the image. Any ideas about this?

Thanks for your inquiry. I tried using localhost and all works fine on my side. Here is my html string

string html = "<img src='http://localhost/MySite/Pictures/Big/F3.jpg' />";

Please make sure that image exists and you have rights to read image.
Also try to open image in browser.
Best regards

Well, it seems to be working now. Go figure. Thanks!