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

Free Support Forum - aspose.com

NullReferenceException is thrown when saving document

NullReferenceException is thrown when Document.Save() method is called. I use Aspose.Words version 16.2.0.0. Here is a full code (file 16.docx is attached):

public class HandleImageSaving1 : Aspose.Words.Saving.IImageSavingCallback
{
void Aspose.Words.Saving.IImageSavingCallback.ImageSaving(Aspose.Words.Saving.ImageSavingArgs e)
{
e.ImageStream = new MemoryStream();
e.KeepImageStreamOpen = false;
}
}

public void TestDocumentSave()
{
using (var stream = new FileStream(@"C:\16.docx", FileMode.Open))
{
AsposeLicenseController.GetAsposeLicense();

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = LoadFormat.Docx;
Aspose.Words.Document inputDocument = new Aspose.Words.Document(stream, loadOptions);

Aspose.Words.Saving.HtmlSaveOptions saveOptions = new Aspose.Words.Saving.HtmlSaveOptions();
saveOptions.ImageSavingCallback = new HandleImageSaving1();
saveOptions.PrettyFormat = true;

using (var processingStream = new MemoryStream())
{
inputDocument.Save(processingStream, saveOptions); // exception is thrown here!
}
}
}



Hi Dmitry,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13369. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-13369) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.