views:

225

answers:

1

I have some code that uses Open XML to open up a .docx file, find all MailMerge fields, and replace them with data (ignoring the datasource that may have been provided).

I initially tested this against a document created in Office 2007 and it seemed to work great.

We then created one in 2003 based off an Excel spreadsheet data source and saved it to 2007 .docx format. When we open the file produced by my code, Word warns the user that it is going to execute some SQL, specifically SELECT * from 'Sheet1$'. It has options of Yes/No. Selecting Yes requires I find the data source. Selecting No brings me to the document, which appears to be correct.

I'm not sure why I'm now seeing this pop-up. Perhaps it's due to a different data source for the 2003 document?

My hope was that there was a way to delete all references to any datasources and that the pop-up wouldn't show. I found this, but it doesn't seem to work. Any suggestions?

A: 

Ok, I found out how to do this. Had to get the settings part from /word/settings.xml, find the w:mailMerge entry and delete it.

Dan
Hey Dan, great to see you found it. You can accept your own answer as the correct one (the checkmark on the left).
Otaku