I am running into an issue, where when I am mail merging, the template document is locked for the duration of the merge. Is there a way to work with the document without actually opening it and locking it?
using (var fileStream = File.Open(templateFile, FileMode.Open)) {
var document = new WordDocument(fileStream, formatType);
var mergeTable = new MailMergeDataTable(dataName, data);
document.MailMerge.MergeField += new MergeFieldEventHandler(MergeField_InsertPageBreak);
document.MailMerge.ExecuteNestedGroup(mergeTable);
if (_stream == null) {
_stream = new MemoryStream();
}
RemoveEmptyPage(ref document);
document.Save(_stream, formatType);
document.Close();
_stream.Position = 0;
return _stream;
}