9
C# allows for variables to be declared nullable. X++ does not understand this. This makes it impossible to do certain functions in D365 when integrating to MS Office Applications like Excel.

I have been working on an export from D365 directly to Excel and am using a lot of .Net style syntax such as:

cell.get_Style().get_Font().set_Bold(true);

In that case, the set_Bold() function expects a System.Boolean value, so “true” works just fine

But in another case, I am trying something similar with

conditionalFormattingRule01.get_Style().get_Font().set_Bold(bold);

but the set_Bold() method is now expecting a System.Nullable`1[System.Boolean] value, so true will not work. This is because an X++ boolean variable cannot be converted to a nullable System.Boolean variable. Therefore this Excel feature (and hundreds of others) are unavailable to me in X++.

I have even tried tricking the system by using a .Net function to return a nullable System.Boolean value to the set_Bold() method. But in this case the nullable boolean gets auto-converted into an X++ boolean before it is passed to the next .Net function.

The crux of the problem is that MS office functions require nullable variables and there is no way to pass them from X++.

This limitation is making a lot of office features off-limits for me.
Category: Development
STATUS DETAILS
Needs Votes

Comments

T

Same issue here when using an external .NET library. Only the boolean? type does not seem to work.

Category: Development