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

Free Support Forum - aspose.com

Aspose.Words for .net - HTML to Docx

Hi,

I tried out converting an html document to docx using Aspose.Words for .net. It is working fine, but if the html contains images, it does not shows up inside the converted docx file.

Im triying to use this inside Sharepoint 2010, I will be creating the html by joining the list items, so the image url might be like "libraryname/imagename.png" or an http url.

Please advise.

Thanks

Raziq

Hi

Thanks for your request. The problem might occur because Aspose.Words cannot find the images by specified paths. Have you tried specifying full path to image to full url. I think, in this case, the images will be correctly imported into the document.

Best regards,

tried giving full url, that alo doesn't seems to work

thank

Hi

Thanks for your inquiry. Could you please attach the input HTML document (with images) you are getting problem with? I will check it on my side and provide you more information.

Best regards,

Please find the samle html code...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<title></title>

</head>

<body>

Looks how cool is <font size="x-large"><b>Open Xml</b></font>.

Now with <font color="red"><u>HtmlToOpenXml</u></font>, it nevers been so easy to convert html.

<p>

If you like it, add me a rating on <a href="http://notesforhtml2openxml.codeplex.com">codeplex</a>

</p>

<a href="http://www.wikipedia.org">

<img alt="Wikipedia, the Free Encyclopedia" src="_layouts/TestProject/Wikipedia-logo.png" />

</a>

<table width="50%" align="center" border="1">

<tr>

<td rowspan="2">Anime Studio</td>

<td>Pixar</td>

</tr>

<tr>

<td>Studio Ghibli</td>

</tr>

</table>

<table width="100%" border="1">

<tr style="font-weight: bold">

<td>Studio</td>

<td colspan="2">Animes</td>

</tr>

<tr>

<td>Pixar</td>

<td>The incredibles</td>

<td>Ratatouille</td>

</tr>

<tr>

<td>Studio Ghibli</td>

<td>Grave of the Fireflies</td>

<td>Spirited Away</td>

</tr>

</table>

The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.

</body>

</html>

Hello

Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words (10.4.0). Here are my steps:

1. I have created virtual directory on my machine.

2. Then I have added images to this directory

3. And then I have converted HTML to DOC.

Moreover I have tried using the following code, and it works fine too:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertHtml("");

doc.Save("C:\\Temp\\out.doc");

I think, in your case you can try using MHTML, which is actually HTML with all resources embedded. Also, you can try storing your images as base64 in your HTML documents. Using Aspose.Words you can import and export HTML with such images:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.saving.htmlsaveoptions.exportimagesasbase64.html

Best regards,