Hi,
I have to use word management on jobqueue to create word documents and send by e-mail.
First of all I know this topic, but hope it's only up to word2003:
https://support.microsoft.com/en-us/kb/257757
I develop with Windows 10, NAV2016, Word 2016.
I created a copy of codeunit 5054 Word Management and set all dotnet variables to runonclient No.
Also I created a small codunit, which uses one existing segmenlt line with attachment to create one word document and send this by e-mail.
If I run this solution client side, all runs fine.
With my serverside word management codeunit I get the follwoing error:
A call to System._ComObject.set_MainDocumentType failed with
this message: The type of one or more arguments does not match
the method's parameter type.
All word objects are instantiated serverside, also the two documents (.DOC /.HTM) are created serverside.
The error happens after the second line below:
WordDocument := WordHelper.CallOpen(WordApplication,MainFileName,FALSE,FALSE);
WordDocument.MailMerge.MainDocumentType := 0;
These 2 lines are original out of codeunit 5054 function ExecuteMerge.
Maybe when running on server the nst does not the same casting C/AL to .net like the rtc?
Any ideas are welcome.
Thanks
Andreas
Answers