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

Free Support Forum - aspose.com

Keeping the original path to images in html

Hi,

I have a document which I save as html in a folder called 'MyReports\'. I need to insert into it, html with images that is generated dynamically. The images are also downloaded dynamically to an images folder under 'MyReports\', say, 'MyReports\images\'

I've noticed that saving the doc copies the images to 'MyReports\' and changes the 'src' attribute of the 'img' tag to point to the copy of the image. This creates duplicate copies of the image, one in 'MyReports\' and one in 'MyReports\images\'.

I'd like to avoid this image redundancy. Is there a way to keep the original path to the image in the html? (and thus eliminating the need to copy the image)

Thanks in advance,

Itai

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. When you open HTML document using Aspose.Words, HTML document is converted to Aspose.Words DOM. Images in HTML are represented as embedded images, so if you save the document in DOC, DOCX or any other Word document format, images will be embedded.

When you save the document in HTML format, images are saved as a separate files in the folder specified in SaveOption:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/aspose.words.saveoptions.htmlexportimagesfolder.html

In your case, you can alter names of images during saving the document. You can use HTMLExportImagesSaving event handler:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/aspose.words.saveoptions.htmlexportimagesaving.html

Hope this helps.

Best regards,