.NET - Call NotInheritable Class

balta

Member
Hello,

I am starting in .NET in OpenEdge.

How do i call a NotInheritable Class in OE?

1602766397986.png

I am trying to use Spire.Xls.

This don´t work.

def var oXlsWorkbook as Spire.Xls.Workbook.

Thanks,
Baltazar
 

Osborne

Active Member
I have no experience with NotInheritable Classes so cannot answer that part, but the version of Spire.Xls found here works fine with Progress:


When you say it does not work what error message are you getting?
 

Osborne

Active Member
If this is the message then it means your Progress session is not seeing/knows nothing of the relevant component:
Invalid datatype specified: Spire.Xls.Workbook. Specify a datatype such as 'character' or the name of a class. (5638)
** Could not understand line 1. (196)
Try the following:
  1. Place Spire.License.dll and Spire.XLS.dll in the Progress/Project working directory - MESSAGE SESSION:TEMP-DIRECTORY VIEW-AS ALERT-BOX.
  2. As per this site - OpenEdge 11.7 Documentation - add the Spire.XLS.dll via the "Local Assemblies" tab.
  3. Save the assemblies.xml in the same directory as the .dll files and quit Assembly References. You may need to restart the session so these will be picked up.

This should hopefully get you started.
 

balta

Member
I add in startup the assemblies folder.

I add the 2 files in assemblies.xml folder.

1602845183277.png

The files are in the same folder.

The problem is that "WorkBook" is NotInheritable (static, sealed). I cannot call the class.

If using other class (Inheritable) it is Ok.

Can you share the code that works with Progress?

Thanks,
Baltazar
 

Osborne

Active Member
What you have done seems correct, and as per the first two attached images it should work okay.

Where are you getting the NotInheritable information from? As you can see from the last three attached images Progress Developer Studio does not say they are NotInheritable and only seems to have one version of the Workbook constructor.

I just cannot explain why you are having the problem.
 

Attachments

  • SpireXls1.png
    SpireXls1.png
    16.5 KB · Views: 3
  • SpireXls2.png
    SpireXls2.png
    25.9 KB · Views: 3
  • SpireXls3.png
    SpireXls3.png
    22.9 KB · Views: 3
  • SpireXls4.png
    SpireXls4.png
    27.1 KB · Views: 2
  • SpireXls5.png
    SpireXls5.png
    6.9 KB · Views: 2

Osborne

Active Member
Progress 11.7.

That screen is the Class Browser screen in Progress Developer Studio:

1602848946686.png

Expand the relevant project - only available if you have created one - and Referenced Assemblies, right-click the component and select:

1602848584451.png
 

Osborne

Active Member
Yes, version 4.0 of the dll:

1602853331785.png

Really odd that you are not seeing any classes for it. What do get when you run this:
Code:
DEFINE VARIABLE oAssembly AS System.Reflection.Assembly NO-UNDO.

oAssembly = System.Reflection.Assembly:LoadFile("C:\PathToFile\Spire.XLS.dll").

MESSAGE oAssembly:FullName SKIP
        oAssembly:PermissionSet SKIP
        oAssembly:SecurityRuleSet SKIP
        oAssembly:IsFullyTrusted SKIP
        oAssembly:ReflectionOnly
        VIEW-AS ALERT-BOX.
I get:

1602855102739.png
 

balta

Member
I have the same info

1602855366646.png

Should be a bug of 11.6. I will try to upgrade to 11.7.

1602855836836.png

If another class, it is OK.

1602855868575.png
 

Osborne

Active Member
Unfortunately the three dll files are too large to attach but they were downloaded from here and all unblocked:


1603205984455.png

The assemblies.xml file is blocked from sending so have changed to text to show you how it looks.

The start-up parameters for the shortcut are very simple:

Target: C:\Progress\OpenEdge11\bin\prowin32.exe
Start in: C:\DotNet\SpireXLS

The three dll's and assemblies.xml are in C:\DotNet\SpireXLS.
 

Attachments

  • Compiles.p
    61 bytes · Views: 2
  • assemblies.txt
    268 bytes · Views: 2

balta

Member
If I put all in the same folder, it works…

1603286856297.png

The startup that I have is:

C:\OE11\bin\prowin32.exe -basekey "INI" -ininame s:\usr2001\swl\desenv.ini -pf s:\usr2001\swl\001Editor.pf -assemblies S:\Unitex\Assemblies -filterocxevents

The files are there, with correct assemblies.xml.

1603287318467.png

With this, I have the error. I don't understand...
 

Osborne

Active Member
What is noticeable from your last image is Spire.Pdf.dll is missing, and so as a test I removed this from my directory and it then stopped working! So that seems to be the answer, links are being made with Spire.Pdf.dll.

I assumed Spire.Pdf.dll was for PDF work and not required for Excel workbooks but in this case is required.

I have come across this in .NET once before in that a certain .dll has to exist in the same directory even though you make no direct reference to that .dll.
 
Top