Page Load called multiple times when saving document to stream using ViewInBrowser

I’m evaluating your product, and have made a little aspx page to test it. In page load I have the following…

DataTable dt = rpt.GetResults(); // routine to return a datatable.

string templatePath = path + “CamperTemplate.doc”;
Aspose.Word.Document doc = new Document(templatePath);
doc.MailMerge.Execute(dt);
doc.Save(“test.doc”, SaveFormat.FormatDocument, SaveType.OpenInBrowser, this.Response);

There are three rows in the datatable, and what happens, is page load is being called 3 times, apparently once for each row. when I change the SaveType to OpenInWord, I don’t have this behavior. I have tried your examples, and they don’t seem to exhibit this behavior either.

What could be the problem?

Thanks,

Stuart Miller

Hi Stuart,

Thank you for considering Aspose.

Please try to move at least the Save method out of the Page_Load, say in a button click handler. Does it help?