Free Support Forum - aspose.com

Duplication when button is clicked more than once

Hi

I have web app that creates a Word doc using Apsoe Word. When you clcik the button that creates the document it goes away and creates teh document. However if you click teh button again it creates teh document again but add it to the previouse document.

It seems liek it is keeping it in memeory. How can I dispose of the object after each click. Im doing teh following

doc.MailMerge.Execute(dt)

doc.Save("myDoc.doc", Aspose.Word.SaveFormat.FormatDocument, Aspose.Word.SaveType.OpenInWord, Me.Response)

I tried doc = Nothing , but this does not get rid of previosue document.

Any ideas?

thanks in advance

Mail merge fills the document it is invoked on. You can’t expect to mail merge into the same Document many times (unless this is what you want). Open new Document object before each mail merge.