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?