1. Gene Kanten
  2. PowerBuilder
  3. Thursday, 14 December 2023 23:17 PM UTC

I am trying to add a .pdf file using the ole.InsertFile() function.

It is returning a -9 (=Other error)

I can open the .pdf file successfully in Adobe Acrobat and in Firefox so the file is valid.

The .pdf file is on my C: drive.

I can add other file types successfully.

Seems like an OLE issue but getting only (other error) is not very helpful.

I'm using Windows 11 and PB 2022.

Any ideas?

 

 

Gene Kanten Accepted Answer Pending Moderation
  1. Friday, 15 December 2023 19:15 PM UTC
  2. PowerBuilder
  3. # 1

I did not create the OLE control so I don't know what control was selected.

It was created many years ago by someone else who is no longer with the company.

Is there no place the control that was selected is stored?

Can you selected multiple controls? or does it support all the controls that are displayed?

 

I am simply debugging it to see why it isn't working.

I can tell you that in the window we can select may different file types (.doc, .txt, .xlsx, .pdf, jpg  etc) and that the window does

an ole.Insertfile() and then stores the blob returned from ole.ObjectData.

When the window opens the file the blob is then retrieved and put in ole.ObjectData and then it does an ole.Activarte(InPlace!) to display the file.

All the other file types seem to work except for .pdf files. It seems to be something local to my PC because it is still working in production (I think).

Comment
  1. Chris Pollach @Appeon
  2. Friday, 15 December 2023 19:24 PM UTC
Hi Gene;

Have a look at he OLE Control's "Properties" that you are using in the appropriate painter.. In there should be the class name of the OLE object being used within that container. HTH

Regards .. Chris
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 15 December 2023 18:44 PM UTC
  2. PowerBuilder
  3. # 2

When you created the OLE control in your window, you were presented with a dialog window similar to this:

The list of objects may vary, depending on what is installed & available on your computer.

Which object type did you select? If you clicked the Cancel button and placed an empty OLE control on the window, then there is no OLE functionality...there is only an empty container, which is a problem. If this is the case, you can right click on the OLE control in the Window Painter and select "Insert..." from the popup menu to re-display the Insert Object dialog window.

Comment
There are no comments made yet.
Gene Kanten Accepted Answer Pending Moderation
  1. Friday, 15 December 2023 18:17 PM UTC
  2. PowerBuilder
  3. # 3

Thanks John, I don't know how to I find out what OCX is being used.

Is there somewhere I can look to find that?

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 15 December 2023 02:54 AM UTC
  2. PowerBuilder
  3. # 4

Hi, Gene -

Um... what OCX are you using? Is it one that would support an "insert file"-type of action? Does the bitness of the OCX match the bitness of the app?

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.