Free Support Forum -

Mailmerge results in a single blank page returned

Dim license As License = New License
Dim doc As New Document(TemplateLocation)
doc.Save(SavePath, SaveFormat.FormatDocument)

I'm using the above code to do a mail merge (the datatable already has data in it before the above code). For some reason the word document gets generated, and saves ok, but its completely blank (even the hardcoded writing in the document is removed). What could be causing this please? Could it be an incorrect setup of the license file?



Hi Simon,

Thank you for considering Aspose.

It is more likely related to incorrectly formed document, but to make sure, comment out the line containing SetLicense and execute the mail merge.

Please make sure that name of the merge field(s) in the document are completely similar to the data table field name(s). Also, check if you are using the latest version of Aspose.Word. If nothing helps, please attach your template document and possibly post the data table schema.

I have tried removing the license and it then mailmerged a blank page with the red text at the top saying that im using a demo version of aspose.word, but that is all, the rest is just a blank page. I cant think what the problem might be.

First i thought it might not be loading the template properly so i tried setting the template location to one i know does not exist and it comes up with a file not found error, which means that it must have been loading the right template.

Its weird tho, its not like its just mailmerging nothing because even the text that it typed in manually does not appear. Its not as though ive got a complicated template, its basically a page with “This is Case Number” and a mailmerge field <> .

If i try to execute a mailmerge on an empty datatable will that give me a blank page? or will that just give me the original page but with the mailmerge fields blank?

Which circumstances result in a blank page being created?

Thanks for your help



Yes, execution a mail merge on an empty data table seems to make the document completely blank. But you said that your DataTable is properly populated before the execution? Please check it again.

Anyway, this is probably an incorrect behaviour of the mail merge engine, maybe we will make it to throw an exception or something.

yeah, some kind of excetion or just an option to continue with a blank merge or something would make it easier.

I will have to check to see if the datatable is being populated correctly. It was working before i started using aspose, but i am not the only developer on this project, there is a chance that someone has made changes to the windows client and that has affected the stored procedures im using.

Thanks for your help