Wednesday 20 August 2008

OpenOffice and Dynamics ax

Here is an example of how to use OpenOffice together with Dynamics AX (code-wise of course)

static void Job2(Args _args)
{ COM OpenOffice;
COM DeskTop;
COM Document;
COMVariant arg;
Array arr = new Array(Types::String);

//Creating instance of OpenOffice.org
OpenOffice = new Com("com.sun.star.ServiceManager");
DeskTop = OpenOffice.CreateInstance("com.sun.star.frame.Desktop");

// create and initialize a COMVariant object
arg = COMVariant::createFromArray(arr);
//Creating the document
Document = DeskTop.LoadComponentFromURL("private:factory/scalc", "_blank", 0, arg);
}

Original post by Ivan Kasperuk

No comments: