
Lieven De Foor (MIPS) asked a question.
Has anyone successfully used Open XML SDK from ABL?
Hi,
I'm trying to get the Microsoft Open XML SDK running in ABL.
I've downloaded the nuget package here, extracted the .NET 4.6 DocumentFormat.OpenXml.dll assembly from it and added it to a new empty workspace/project.
While the assembly seems to be found for code completion and adding a USING statement, not even the simplest statement is compiling:
- USING DocumentFormat.OpenXml.Packaging.SpreadsheetDocument FROM ASSEMBLY.
-
- DEFINE VARIABLE spreadsheetDocument AS SpreadsheetDocument NO-UNDO.
Trying the same with the OEDT plugin active even crashes eclipse while applying the OEDT facet/building the assembly model.
Has anyone successfully used the Open XML SDK from ABL and if so how did you succeed?
As a short answer, no.
I assume the interest in Open XML is because COM is no longer reliable (or just plain doesn't work) on PASOE? Sadly, having looked at Open XML, I can see why COM is still very popular. Open XML is not easy to work with.
It looks like, that the .net bridge has a problem with this dll. Browsing through the "Class Browser" View for this assembly results in a jvm crash:
Two things come to mind.
1) I had a problem with a different MS .net DLL downloaded from Nuget. The solution to my problem was provided by Progress tech support and is referenced in this kbase. https://community.progress.com/s/article/Unable-to-use-classes-from-Microsoft-SqlServer-SqlManagementObjects-in-Developer-Studio
2) Once you get it working and waste a lot of time testing it out, you will soon discover that the use of this DLL requires access to generic methods that Progress can't handle. It's been a while but if I recall, statements like this are the problem. spreadSheet.WorkbookPart.Workbook.GetFirstChild<Sheets>()
I gave up
While not very practical when you need to use a lot, but there is cure to that problem: https://github.com/consultingwerk/ReflectionHelperOSS
If we can get the assemblies using the KB articles approach we might be able to create some helper class in C# to provide typed versions of the most common generic method we would like to use.
So instead of writing
we might be able to do:
Try this, it works with ABL
https://www.nuget.org/packages/EPPlus
We're not looking for a commercial solution at the moment.
We're currently looking at ClosedXML which might be an alternative (and uses OpenXML under the hood).
Until version 4 it wasn't commercial, didn't notice that there is a V5 avail.
https://www.nuget.org/packages/EPPlus/4.5.3.2
I also recommend EPPlus. I've been using version 4 for many years, it has been working fine and it's easy to use.
Comfirmed bug OCTA-37408, no fix/workaround yet...