Free Support Forum - aspose.com

Image duplication using preview for HTML

Using the 3.7.10 version of the Aspose.Words.dll for .Net 1.1, we are using the Save function of the Document class to stream a given word document to HTML. See code below:

Dim license As Aspose.Words.License = New Aspose.Words.License
license.SetLicense(ConfigurationSettings.AppSettings("ASPOSE_WORDS_LICENSE"))

Dim oProposal As New bsProposal
Dim doc As Aspose.Words.Document

doc = oProposal.LoadWordDocument(Request.QueryString("item"))
doc.SaveOptions.HtmlExportHeadersFooters = True
doc.SaveOptions.ExportImagesFolder = CStr(ConfigurationSettings.AppSettings("ASPOSE_WORDS_EXPORTIMAGESFOLDER"))

doc.SaveOptions.HtmlExportImagesFolderAlias = CStr(ConfigurationSettings.AppSettings("ASPOSE_WORDS_HTMLEXPORTIMAGESFOLDERALIAS"))

Dim stream As MemoryStream = New MemoryStream
doc.Save(stream, SaveFormat.FormatHtml)
slideLabel.Text = "

" & System.Text.Encoding.UTF8.GetString(stream.ToArray()) & "
"

This works fine, however, should the original document contain an embedded image, we are sometimes experiencing an issue whereby the image appears twice in the rendered HTML.

Please find attached .zip file containing a screeen shot of the HTML and the original document to assist you with diagnosing this problem.

Thanks, Allan Ashton.

The issue exists in Aspose.Words 3.7.1 but seems to be fixed in version 4.0 beta. We are going to release 4.0 in two weeks so please consider upgrading to the latest version.

4.0 beta is available for download on Aspose.Words download page.

Best regards,