Free Support Forum - aspose.com

Mail merge data source

Hi,

I have created a document which uses an excel datasource to retrieve its field list. Once created this document is uploaded to our web site and a merge is done on it. Unfortunately, when the document is merged and sent back to the user word still generates an authorisation dialog about accessing the datasource. Is there any way of saving the document as a normal letter rather than a merge document or of deleting the merge data source details from the document?

Currently I merge the word document with a datatable using maildocument.mailmerge.execute(dattable). I would anticipate that I would then execute something like maildocument.mailmerge.converttoformletter

Thanks,


This message was posted using Page2Forum from Mail Merge and Reporting - Aspose.Words for .NET

Hello

Thank you for your interest in Aspose.Words. Could you please attach your input, output and expected output documents here for testing? I will check them and provide you more information.

Best regards,

OK, so after further investigation (and no reply from you support goblins) I have found the mailmergesettings properties. So I have added the following code:

MailDocument.MailMergeSettings.Clear() MailDocument.MailMergeSettings.DataSource = "" MailDocument.MailMergeSettings.LinkToQuery = False MailDocument.MailMergeSettings.Query = "" MailDocument.MailMergeSettings.ConnectString = "" MailDocument.MailMergeSettings.DataType = Aspose.Words.Settings.MailMergeDataType.None MailDocument.MailMergeSettings.MainDocumentType = Aspose.Words.Settings.MailMergeMainDocumentType.NotAMergeDocument MailDocument.MailMergeSettings.HeaderSource = ""

However, this doesn't seem to work :-( All I want to do is remove the mailmerge settings from the created document.

We originally created an excel sheet with our standard database fields listed in it. The client can download this and a merge document (created using Word) from our application. The client can then use the normal Word mail merge functionality to create their template document. They then upload this document to our web application. We have built the functionality to allow them to merge this document with 1 or more of our business objects. We then programaticaly perform a merge. The issue comes when the user downloads the newly created document (in DOC or DOCX format) as they still get a dialog asking to confirm the datasource connection. How do I stop this dialog?

Sorry, didnt see your reoply asking for docs :-)

The ZIP is what we send to the client,

JM Test merge source removal employee.doc is the output of the process

Hello

Thank you for additional information. It seems the problem occurs somewhere on your side. To check this please try executing mail merge using MS Word and compare the output documents. If this behavior occurs with MS Word output, then it is expected Aspose.Words behavior.

Please let me know in case of any issues. I will be glad to help you.

Best regards,

Hi,

When I do this through Word I get a document at the end that does not ask me to confirm the query it will use to perform a merge. The document that is produced by Word is just a norml Word document and has no mail merge functionality in it. I would like my Aspose merge to do the same thing.

I accept that I may be doing something (or not doing something) to cause the mail merge data source etc to be left in the document, I just need to know hwo to perform a merge that will result in a standard word document (that contains no data source details).

Thanks,

Jon

Hello

Thank you for additional information. But I cannot reproduce the problem on my side using the latest version of Aspose.Words (10.5.0) and the following code for testing:

doc.MailMergeSettings.Clear();

As I can see the output document does not contain any Mail Merge setting specified.

Best regards,

Thanks for the reply,

This is my code (I am using 10.5.0):

datTable = makeDatatableForMailMerge()

MailDocument.MailMerge.Execute(datTable)

       </p><p> MailDocument.MailMergeSettings.Clear()

       </p><p>Dim OutputMemStream As New System.IO.MemoryStream           </p><p>MailDocument.Save(OutputMemStream, SaveFormat.Doc) </p><p>[I then stream the OutputMemStream to the response object]</p><p>What am I doing wrong? What are you doing differently? The merge process works as I get a good document out of the end, the resulting document just contains the merge settings ... ?</p>

Hi

Thank you for additional information. Please try to clear the path of the template attached to the document:

Document doc = new Document("C:\\Temp\\JM+Test+Merge+source+removal+Employee.doc");

doc.AttachedTemplate = string.Empty;

Hope this could help you.

Best regards,

Thats done it, thanks :slight_smile: