Blog

Work with excel documents on the server side in Dynamics Ax

As you probably noticed, the SysExcel classes in Dynamics Ax only work on the client side. Therefore, if you use these classes in a service or in a batch process you will get an error. In order to overcome this problem you will need to create a custom .DLL.

Creating a .DLL sounds simple, but you could encounter different configuration issues on your server, so these are the steps I have done that managed to make it work:

  1. Your .DLL should reference the Microsoft.Office.Interop.Excel library
  2. Deploy the assembly in the server
  3. On the AOS server, make sure you have installed Microsoft Excel
  4. Ensure the DCOM Microsoft Excel application is listed: Use command C:\Windows\SysWOW64> mmc comexp.msc /32, go to Component services/Computers/My computer/ DCOM Config and Microsoft Excel Application should be listed there. 
  5. Check security for Excel DCOM, for this, in Component services, right click on My Computer and select properties.
    Choose the COM Securities tab
    In Access Permissions, click "Edit Defaults" and add the AOS account to it and give it "Allow local access" and "Allow Remote access" permission.
     In launch and Activation Permissions, click "Edit Defaults" and add AOS account to it and give it "Local launch", "Remote launch", "Local Activation", "Remote Activation" permissions. In Component services, go to DCOM Config, right click and hit Refresh.
  6. Make sure the Desktop folder exists as below:

    C:\Windows\System32\config\systemprofile\Desktop and give access to the AOS account to folders starting from config folder all the way to Desktop

    C:\Windows\SysWOW64\config\systemprofile\Desktop and give access to the AOS account to folders starting from config folder all the way to Desktop

This will for sure save you a lot of time, if you have issues you can always write your comments here to help you.

Comments

Thanks.




Back to Blog

© 2017 Dynaxti, inc. All rights reserved.

Navigation

Social Media