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?

Thanks.

Laurie
connect@oconnect.com


This message was posted using Aspose.Live 2 Forum

Hi

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 = "";

//Insert HTML

builder.InsertHtml(someHtml);

//Save document

doc.Save(@"Test009\out.doc");

I hope this could help you.

Best regards.

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.

Laurie

Hi

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

string html = "";

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!