Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

How to use "microsoft.office.interop.word" in batch execution (on server-side) in AX 2012?

$
0
0

Hi all,

I need to convert some .docx into PDF and this process needs to be executed in batch. I have decided to use "microsoft.office.interop.word", so I made a development in .NET and called the assembly reference in AX 2012.

This is my C# code:

using Microsoft.Office.Interop.Word;

            Application word = new Application();
            Document     doc = word.Documents.Open(@"test.docx");

            doc.Activate();
            doc.SaveAs2(@"test.pdf", WdSaveFormat.wdFormatPDF);
            doc.Close();

            word.Quit();

If I run code client-side, I do not have problem, otherwise if I run code in batch (on server-side): 

word.Documents.Open(@"test.docx");

return NULL value, then I catch this exception in AX:

"System.NullReferenceException: Object reference not set to an instance of an object."

at line doc.Activate();

Other points:

-MS Word is installed on AOS.

-CIL is correctly compiled.

It seems to be a security problem server-side that blocks process, what do you think about?


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>