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

Free Support Forum - aspose.com

Document.Save - SaveFormat.Html - HtmlExportImageSaving to Azure Blob

Code so far:

var doc = new Aspose.Words.Document(blobStream);
doc.SaveOptions.HtmlExportImageSaving += new Aspose.Words.Saving.ExportImageSavingEventHandler(SaveOptions_HtmlExportImageSaving);
var parameters = doc.Save(docStream, SaveFormat.Html);

Now, I have written an event handler that takes the stream and writes it to an Azure Blob, and I will write some code to substitute the anchor hrefs in the html accordingly.
Question: how can I get the save call to not want to save the images to a file?


Thanks for your inquiry. You can specify Stream where images should be saved. For example see the following code:

public void Test001()
    // open document with images.
    Document doc = new Document(@"Test001\in.doc");
    // Add ImageSavingCallback, where we will store images into a stream.
    // NOTE: starting from 9.2.0 version of Aspose.Words HtmlExportImageSaving event was replaced with callback.
    HtmlSaveOptions opt = new HtmlSaveOptions(SaveFormat.Html);
    opt.ImageSavingCallback = new HtmlImageExportCallback();
    opt.PrettyFormat = true;
    // Save HTML document to stream.
    using (MemoryStream htmlStream = new MemoryStream())
        doc.Save(htmlStream, opt);
        // Just for testing output HTML into Console.
private class HtmlImageExportCallback : IImageSavingCallback
    public void ImageSaving(ImageSavingArgs args)
        // Specify stream where an image should be stored.
        MemoryStream imageStream = new MemoryStream();
        args.ImageStream = imageStream;
        args.KeepImageStreamOpen = false;

Hope this helps.
Best regards,

hi,i have download the Aspose.Pdf.dll,but there is not exists SaveFormat.Html,my .net Frameword is 3.5,help!!!


Thanks for your inquiry. For your queries about Aspose.Pdf component, please post your questions in Aspose.Pdf forum where you will be guided appropriately.

Best Regards,