Word Managemant on ServiceTier

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

  • bbrownbbrown Member Posts: 3,268
    AFAIK MS Office continues to be supported as a client-side application only. You may get some things to work thru a service (I've had limited success with Excel automation on NAS) but you are basically on your own.

    There are no bugs - only undocumented features.
  • okioki Member Posts: 46
    Did you start your client on the service tier server for testing? Could be that there are different versions of Office/Word installed.
  • entwicklerdotnetentwicklerdotnet Member Posts: 4
    Client runs as long as the variable is runonclinet=yes, if set to no the same arror appers. only office2016 installed
Sign In or Register to comment.