With
reference to your Release Notes for 9.2.0 Aspose Words I could not find
the property ‘ImageSaving’ in the class ‘HtmlSaveOptions’.
So how should I have to change the code to get the same result.
private static Dictionary <string, MemoryStream> mImagesList = new Dictionary <string, MemoryStream> ();
public static MemoryStream ConvertDocToZippedHtml(Document doc)
{
// Create memory stream where output zip file will be stored
MemoryStream zipStream = new MemoryStream();
// Create zip archive
ZipOutputStream zip = new ZipOutputStream(zipStream);
// Spacify HtmlExportImageSaving event handler
doc.SaveOptions.HtmlExportImageSaving += new ExportImageSavingEventHandler(HtmlExportImageSaving_ZipImage);
// Specify image folder aliase
doc.SaveOptions.HtmlExportImagesFolderAlias = "images/";
// Save document to stream in HTML format
MemoryStream htmlStream = new MemoryStream();
doc.Save(htmlStream, SaveFormat.Html);
// Put HTML into the zip archive
ZipEntry htmlEntry = new ZipEntry("index.html");
zip.PutNextEntry(htmlEntry);
zip.Write(htmlStream.GetBuffer(), 0, (int) htmlStream.Length);
// Loop through all images
foreach(KeyValuePair <string, MemoryStream> img in mImagesList)
{
ZipEntry imgEntry = new ZipEntry(string.Format("images/{0}", img.Key));
zip.PutNextEntry(imgEntry);
zip.Write(img.Value.GetBuffer(), 0, (int) img.Value.Length);
}
// Finish zip stream
zip.Finish();
return zipStream;
}
private static void HtmlExportImageSaving_ZipImage(object sender, ExportImageSavingEventArgs e)
{
MemoryStream imgStream = new MemoryStream();
e.ImageStream = imgStream;
e.KeepImageStreamOpen = true;
mImagesList.Add(e.ImageFileName, imgStream);
}