Word Merge Extention

Word Merge Extention


Currently we are having some problems with the word merge extention. Sometimes, the application gives a timeout when trying to open the word file. The timeout is random and happends a lot from time to time...

The action that gives a timeout is "MergeDocFromXL"

If we republish the OML it gets fixed, but it's really boring since it happends a lot of times ....

Is it a known version problem? is it fixed already in new versions of the extension? how can we fix this problem?

Does this happends to anyone else?

Best regards,
Luis Paulo Soares

Hello Luís


First, my disclaimer: I am not very accustomed to Wordmerge, and the knowledge I have of that solution comes from handling it sporadically in troubleshooting generic problems, so what I say may or may not be very accurate.


From my knowledge, Wordmerge can timeout if, for some reason, Word stops responding (e.g. if it causes a pop-up on the server) and the solution for it is typically to kill the Word process. When you start getting timeouts, do you see if the Word process remains open? If you kill it, does it continue to time out?




Thx Acácio for your reply. Next time ill get the timeout ill try to grab the error message from the service center monitoring and ill check the word process and servers popups... but its always a good sugestion. thx again. hope it works :s
Hi Luis,

check if you have some indexing service (like windows search or google desktop) running at server and that can be the root of the problems. Also check if you have an anti-virus exclusion to the directory where the wordmerge extension creates the temporary docs.

To prevent having unwanted pop-ups on the server (it happens when trying to merge fields that don't exist on the template doc) you must have the "wrdApp.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone" instruction when you create the word app object.

Hope it help.
Yes the process was running... i tried to kill the process and it worked. Should be any popup window running in the server? how to prevent that?

"wrdApp.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone" instruction when you create the word app object. " where we can insert that instruction to prevent the popup windows??
Hi Luis,

you should do that instruction every time you create a new word.application object.

// Create an instance of Word and make it invisible.
wrdApp = new Word.Application();
wrdApp.Visible = false;
wrdApp.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone
Still continue to timeout...
<br />I also get this exception :
<br />The type initializar for &quot;System.Runtime.InteropServices.CustomMarshalers.EnumeratorToEnumVariantMarshaler&quot; threw an exception.

The timeout only happends times to times... :( kinda weird why it happends sometimes and others it doesnt.
Hi ricardo,
Ive added that code to the extention but it still continue to timeout. :(
I've checked the antivirus folder exclusion list and it was already excluding the folder c:\windows\temp (where the application saves the temp doc files).
Im gonna check antivirus and system logs with more detail and try to figure out why the winword.exe process stops...
you should also check if you have any indexing service like windows search or google desktop.

what's the size of that file?
We dont have any indexing service on the server running.
We have more then 1 template/data. If we debug, the action from the extension that timeouts is MergeDocFromXL. It happends with all our templates/data and the period it happends is random :X sometimes it timeouts and if we wait some hours and try again it starts to work again.

Could be the antivirus that may block some process? or why the winword.exe process stops? maybe antivirus blocks it because probably it is trying to write a temporary file?
Anti-Virus, it can be, but it won't explain hours so you can try again and it works...

Open word files and the templates you have in the server to check if there is a problem with word.

Try to do some merge documents with a word file and an excel to see if the problems occurs.

Wich version of office you said you have?
"Open word files and the templates you have in the server to check if there is a problem with word. " <-- they work ok. i tried to make a http request and they open without any error :(

"Try to do some merge documents with a word file and an excel to see if the problems occurs. &quot;
I tried to use mail merge manually with 1 template + excel and i i got &quot;no errors&quot;. we have more then 1 template and i havent tried any others, but i will try just to check.

"Which version of office you said you have?"
We have office 2003 standard edition on the server.
Some time ago we had a problem with a template because it was been saved with a professional version of office 2003, and when the client tried to open the .doc file, word was asking him if he want to install a converter and the file couldnt be open after, since they couldnt be able to install it. We took more then a week to figure out that the problem was because of a incompatibility problem between standard and professional editions.
The problem persists :( and i cant find out why the action randomly do timeouts :(

Other day we had a diferent error message with something on the interop. but fortunatly after some re-publish's of the eSpace it got fixed...

Can it be because of the extention?? i can post the extention here 2morrow. Should the extention use the interop Dll's of the server?

If an error happend on the MergeDocFromXL function it gives a timeout and it stay/keeps locked? can it be a division by zero? i tried with a xls file already doing it manualy and it was ok :( how to unlock it? sometimes i dont even see any process running on the server so means it doesnt even launch it?

any help would be nice :( this problems starts to become really boring for the client since they cant use it properly :(
I also notice that when it timeouts the process doesnt even start running on the server... so i think when it happends the process probably isnt being launched... maybe something that is blocking it?

ill check it better tomorrow :( sorry for being boring but this problem is making me crazy :(
Should the extension use the interop Dll's of the server?

Yes, and if is not using it its probably the cause.
Today when it was doing timeout i found the errors in attach in the event viewer.
The second error msg goes in the next post since i cant attach 2 files on a single post.

Any ideias about them? :(
Event viewer - Error message 2.
What is "computer E"?

check if you are the correct Interop DLL
The Interop DLL that integration studio use on wordmerge extention should be the one that i have installed on my machine right?

I got MS Office 2003 Pro on my machine and the server MS Office 2003 Std... Do they have to be the same?
This is the extention im using.
does it comes with MS Office 2003?
how about errormsg.jpg any ideias why it happends?

that log was when i tried to use the action from the extention and it wasnt working (timeout). :s
I notice that the process winword.exe was running now on the server... sometimes they get locked and we have to kill it right ? so it starts working again...

the thing now is... it is really boring for the client to have to call us all the time to kill the process... any work around for that?

as i said, install interop package and then remember what i said at 2009-07-02 09:59:25 post and probably you won't have that problem.

last time i used that extenson i did that changes and the client hadn't the problem again since then.

In my opinion word merge extension doesnt work properly... Since its based on a "static" template. If you want to generate some dinamic doc it wouldnt possible. I  also notice that it have a lot of issues with process's and so on.

To fix this problem, i would suggest you to buy a component (if you got extra cash of course) that could convert a .aspx (html) to .doc. I know this is a expensive solution but at least can solve a lot of problems on generating doc files. There is a component named url to pdf in outsystems components. I think they provide also for doc files. This is the expensive solution but at least it seems to work fine and maybe better. I never tried it myself but im considering it.

The free way is to use word merge extention as it is.

About the delay i really dont know sry :(

Hope my opinion helps.

Hi Luís, and thank you for your feedback.

Indeed, our WordMerge extension doesn't do everything, since that's not its goal. As far as doing the word merge process, it works for most of the cases, which is a good standard, and we're always open to getting either community-driven changes as well as feedback on it :)

We have considered purchasing such a component in the past and distributing, but in all honesty, it isn't such a big expense for customers who really need that functionality - we've done projects with full-fledged third-party components that did the trick and the cost ranged from 500$ to 2.000$, depending on how much functionality you needed. This was a couple of years ago, but I recall using Aspose to good effect.

What you are looking for, however, more than a word merge component, is actually an extension/component/API that allows you to create Word documents on the fly, if I understood it correctly.

Aspose has such a component available for trial and purchase, if you're interested in it. That is a use case that we do support - i.e. integrating with such third-party components - but we do not have plans to purchase an OEM license for such a component in the near future.

I hope this helps somehow :)


Paulo Tavares
Hi Paulo,

I think you got my idea. In fact i was takling about a workaround for the worde merge. And currenctly i was looking for something similar to the component u talked about (aspose). Seems a good choise. Thanks.
Hi All,

Anyone familliar with this KB article from Microsoft: http://support.microsoft.com/kb/257757 ?
This KB says serverside Office automation isn't supported. This could be an answer to the problems you experience.


Stephan Schevers
Stephen -

Yes, serverside Word (or any other Office app) is a mess and problematic. The solution is (unfortunately) to use a third party component such as the Syncfusion or Aspose items to manipulate the files without starting Word. I've encountered this a number of times in different situations and it is always a problem. :(