Resource not opening Excel file in ax 2012

75 Views Asked by At

In my Ax 2012 have created one aot resource of type xlsx: a.xlsx as in the image below:

enter image description here

When I try to open and export the a.xlsx resource I cannot open it. It is no saved as a xlsx file. I am trying to open the Resource that I have created by right clicking Open as below:

enter image description here It opens the below window and I click export: enter image description here

I save the file in the folder, but it does not saved as an excel file(.xlsx). enter image description here

Instead it is saved without a type: enter image description here

The same thing happens when I try to open any of the standard resources. It is not opened in the file format as defined in the resource. I have not used resoruces before. Are there any parameters or configuration regarding the resources that I need to set , in order for the resources to work(to be opened)?

In the meantime I do have Excel installed, and it does have the Dynamics AX addin installed, as in the image below enter image description here

P.s. I am using this resource in order to export data in excel in batch thrugh OXMLSpreadsheetDoucment_RU, as indicated in the link below. https://axbytes.blogspot.com/2015/12/readwrite-excel-files-from-aos-using.html

Thanks in advance!

1

There are 1 best solutions below

0
Alex Kwitny On

I am trying to open the Resource that I have created by right clicking Open as below:

That's not how you open/save Excels. That form you're viewing is just a helper form that lets you import/export objects into the Resources node of the AOT for use by other code, typically.

The Resources node isn't designed to be used a file store for you to open/save/edit files. It's designed to be semi-permanent object storage that can be referenced/used by other code and it will travel with the AX codebase.

Look at the code inside the form method here \Forms\SysResourceNodeEdit\Methods\export and you'll see that when you click Export, it's asking you where you'd like to save the file with this line of code:

userInputPath = WinAPI::getSaveFileName(element.hWnd(), ['All Files', '*.*'], '', "@SYS54846", '', filenameOnly);

It's designed as a simple import/export utility. You can modify that code if you'd like to make it save with the actual file extension by referring to what is returned in the type variable from the previous line of code.