1. Berit Sandvik
  2. PowerBuilder
  3. Wednesday, 14 August 2019 06:29 AM UTC

Hi all,

Is there anyone who has any experience using Microsoft Open XML SDK in PowerBuilder? I am using PowerBuilder 2017 R3 and I am not able to establish the connection to the SDK.

What I am uncertain about is the class ID/programmatic identifier for the SDK. I have tried the ones below, but without any success. They all return -2 (Class name not found)

ll_Action = oleExcel.ConnectToNewObject("DocumentFormat.OpenXml.Office.Excel")
ll_Action = oleExcel.ConnectToNewObject("DocumentFormat.OpenXml.Office2010.Excel")
ll_Action = oleExcel.ConnectToNewObject("DocumentFormat.OpenXml.Office2013.Excel")

Appreciate all feedback.

Regards Berit

 

 

 

 

Berit Sandvik Accepted Answer Pending Moderation
  1. Thursday, 15 August 2019 05:50 AM UTC
  2. PowerBuilder
  3. # 1

Thank you for your reply! This is very helpful.

We will check this out when the PB 2019 R2 release is released.

 

Berit

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 14 August 2019 18:49 PM UTC
  2. PowerBuilder
  3. # 2

Adding to what Roland said, here is a code example of how to call C# assemblies using our internal test version of PB 2019 R2:

lcsa_assem = create CSharpAssembly
lcsa_object  = create CSharpObject

ll_return  = lcsa_assem.loadwithnetframework("NetAssemTest.dll", false)
mle_1.text += "lcsa_assem.loadwithnetframework:"+ string(ll_return) + "error:"+string(lcsa_assem.errortext)+"~r~n"

ll_return = lcsa_assem.createinstance("assemblynet.CSharpClass",lcso_object)
mle_1.text += "createinstance:"+ string(ll_return) +"~r~n"

li_c = 1
li_c = lcso_object.GetSalary()
mle_1.text += "GetSalary return =10000:"+ string(li_c)+"~r~n"

And here are some important details to be aware of:

  • All standard datatypes are supported except the object type.   Supported standard datatypes: short, ushort, int, uint, long, byte, bool, string/char, float, decimal, byte[], dateime and so on.

  • You can return a C# array an assign it to a PowerScript array.  We have tested one-dimensional array so far.

  • The datatypes defined in C# do NOT have to have the same arguments as that in PowerScript.  For example, you can define the decimal datatype in C#, and then PowerScript will pass the int/decimal value to C#.

Once PB 2019 R2 is released, we will most likely schedule a webinar to demonstrate and educate about this new feature.  If you are not yet subscribed to Appeon newsletter, we suggest you subscribe so you get notified: http://eepurl.com/bGcjSD

Comment
There are no comments made yet.
Berit Sandvik Accepted Answer Pending Moderation
  1. Wednesday, 14 August 2019 11:03 AM UTC
  2. PowerBuilder
  3. # 3

Hi Roland,

Thank you for the information, this is very helpful!

Regards Berit

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 14 August 2019 10:42 AM UTC
  2. PowerBuilder
  3. # 4

2019-R2 will be able to use .Net directly. It will likely be out in November.

Until then you have to create a COM callable wrapper yourself.

 

Comment
There are no comments made yet.
Berit Sandvik Accepted Answer Pending Moderation
  1. Wednesday, 14 August 2019 10:15 AM UTC
  2. PowerBuilder
  3. # 5

Hi Rene,

Thank you for your comment!

We have just tested it in a small .NET application and it is working fine, so it looks like you are right. We are now installing PowerBuilder 2019 and hopefully it can connect to an assembly.

 

Regards Berit

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 14 August 2019 09:14 AM UTC
  2. PowerBuilder
  3. # 6

Hi Berit,

are you sure that this SDK provides ActiveX?

I think it is only .NET. You can't use assemblies directly with PB. Maybe there is a way in a future release.

Or are you looking for office automation?

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.