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

Free Support Forum - aspose.com

Word 2007 Crashes when merge images are added to header using Aspose.Words

When using pretty standard Document.getMailMerge() functionality on a word 2003 document (.doc) that has image fields in the header or footer Aspose.Words creates a .doc file that crashes Word 2007.
Is this a known issue in any way?
I’ve attached an example of a broken .doc file created in the manner described above. If I merge the images anywhere else on the document besides the header / footer it looks great.

I am using Aspose.Words for JAVA.

Hi
Thanks for your request. Could you also attach your template and provide me code that will allow me to reproduce the problem on my side? I will investigate the issue and provide you more information.
Best regards.

Alexey,

I’ve attached a zip file that contains the template and all images used in the merge. We are using Aspose.Words as a COM Object from Coldfusion MX.

Here is a quick sample of my code as cut from a few functions I created in coldfusion:

d = createObject("java","com.aspose.words.Document");
d.init(templateFile);

m = d.getMailMerge();
m.setRemoveEmptyParagraphs(true); 
m.execute(queryName);
d.save(‘c:\lettertemp’ & key & ‘.doc’);

Hi
Thank you for additional information. I cannot reproduce the problem. Here is code I used for testing:

// Open document
Document doc = new Document("C:\\Temp\\TemplateExample\\TemplateExample.doc");
String[] names = {"users.customLetterImage1"
, "users.signatureImage"
, "letterphoto"
, "users.customLetterImage2"
, "addresses.addressee"
, "addresses.housenum"
, "addresses.street1"
, "addresses.street2"
, "addresses.city"
, "addresses.state"
, "addresses.zip"
, "addresses.greeting"
, "users.contact1"
, "users.contact2"
, "users.contact3"
, "users.contact4"
, "users.contact5"
, "users.contact6"
, "users.contact7"
, "users.contact8" };
String[] values = {"C:\\Temp\\TemplateExample\\MAG_BWHeader001.jpg"
, "C:\\Temp\\TemplateExample\\Signature016.jpg"
, "C:\\Temp\\TemplateExample\\Chris001.jpg"
, "C:\\Temp\\TemplateExample\\MAG_BWFooter001.jpg"
, "addresses.addressee"
, "addresses.housenum"
, "addresses.street1"
, "addresses.street2"
, "addresses.city"
, "addresses.state"
, "addresses.zip"
, "addresses.greeting"
, "users.contact1"
, "users.contact2"
, "users.contact3"
, "users.contact4"
, "users.contact5"
, "users.contact6"
, "users.contact7"
, "users.contact8" };
doc.getMailMerge().execute(names, values);
// Save output document
doc.save("C:\\Temp\\TemplateExample\\out.doc");

Also, you document works fine after open/save it using the latest version of Aspose.Words.

Document doc = new Document("C:\\Temp\\15D3663D.doc");
doc.save("C:\\Temp\\out.doc");

So, I suppose you are using old version of Aspose.Words. Please try using the latest version of Aspose.Words for java:
https://releases.aspose.com/words/net
Best regards.

I downloaded the new version and the problem was fixed, so it was definately a bug in our particular version. However we are running into another problem with handling images with dpi over 96, but I am going to create another post regarding that issue.

Thanks,
Intuvo