1. Rick Domogalik
  2. PowerBuilder
  3. Friday, 3 April 2020 13:14 PM UTC

I want to add a document preview to my application.  I currently have an app that shows a list of various document types in a list.  These documents could be, but are not limited to: Word Docs, Excel Docs, PowerPoints, PDFs and Images(various types). 

Currently if the user double clicks the item, it will open in its native application and the user can edit and save.  I would like to implement a preview window to the right of the document list, so that when the user single clicks on the item in the list, it will preview in the window on the right.

I played a little with inserting an ole object, but this seems really clunky.  I have only done this with PDFs and I assume I would have to change the ole object based on what file type is selected to an appropriate ole object control based on type.  

Is there a way to just generically pop a preview with no edit capabilities, just basic scroll up/dn view of an external file?

 

Thanks

 

 

Rick

Bjarne Anker Accepted Answer Pending Moderation
  1. Monday, 11 May 2020 07:48 AM UTC
  2. PowerBuilder
  3. # 1

Which runtime DLL's is required for the new web browser control?

I've added pbwebbrowser190.dll to our distribution, but it will not load the local htm file containing a logo.

Works just fine with the old OLE control.

 

Bjarne

Comment
  1. Bjarne Anker
  2. Monday, 11 May 2020 09:01 AM UTC
Ok, that'a lot of files I don't have.

Where can I find them?

Not in the Shared folder. GAC_32 og GAC_MSIL
  1. Helpful
  1. René Ullrich
  2. Monday, 11 May 2020 09:18 AM UTC
I have them in C:\Program Files (x86)\Appeon\Shared\PowerBuilder\pbcef190
  1. Helpful
  1. Bjarne Anker
  2. Monday, 11 May 2020 09:22 AM UTC
Found it. Thanks.

Now the application just crashes.



I think I'll revert back to the old OLE control for now.
  1. Helpful
There are no comments made yet.
Daryl Foster Accepted Answer Pending Moderation
  1. Monday, 6 April 2020 04:23 AM UTC
  2. PowerBuilder
  3. # 2

Hi Rick,

 

If you are after a paid solution then Oracle's Outside In ActiveX component will do what you need.  We license it for our internal Powerbuilder apps and have been using it for about 10 years.  I'm not sure of the cost of licensing if you are selling your app, but it might be something to consider.

 

https://docs.oracle.com/en/middleware/standalone/outsidein/8.5.4/viewer-for-activex.html

 

 

Comment
  1. Rick Domogalik
  2. Monday, 13 July 2020 16:15 PM UTC
Would you happen to have snip of a sample script where you opened a document in powerbuilder with Outside in installed as an activex control? I was able to get a demo copy of the control but the documentation is all laid out for c# and .NET and doesn't have the syntax for what methods you can call through PB.



Thanks.

Rick
  1. Helpful
  1. Daryl Foster
  2. Tuesday, 14 July 2020 07:48 AM UTC
Hi Rick,



You first need to add the OIX control as an OLE object on your window or user object. I'm assuming you've done that? Then you can use most if not all of the methods and properties shown in the manual. The main one is to display a file so the method for that is ViewFile. To call it in your Powerbuilder code you do something like this:





long ll_viewed = 0



string ls_filename = 'c:\temp\somefile.pdf'



ll_viewed = ole_oix.object.ViewFile(false, ls_filename)



if ll_viewed < 1 then

MessageBox('Error Displaying File', 'Could not view the file: ' + ls_filename)

end if



You can set properties by using the constant values. When you install the Outside In Viewer it should install some header files in the sdk\common directory (I can't remember is these are part of the Outside In Viewer ActiveX, or the normal Outside In Viewer control, so if you are missing these maybe install the Outside In Viewer control as well). There are a few files there, outsidex.bas, outsidex.cs etc. You can look at these files and check the numeric values of the constants which you can add to your code.



Eg to set the TimeZoneOffset you can use the SCC_TIMEZONE_USENATIVE constant:



constant long SCC_TIMEZONE_USENATIVE = 61440



ole_oix.Object.TimeZoneOffset = SCC_TIMEZONE_USENATIVE





You can just use the numeric values to set the properties, but it will help down the track if you setup the constants. E.g



ole_oix.Object.BMPFitMode = 4



To clear the file that you are currently viewing, just use the Clear method:



ole_oix.object.Clear()





If you need help with anything specific let me know and I'll see if I can help.
  1. Helpful
  1. Rick Domogalik
  2. Thursday, 22 June 2023 14:37 PM UTC
Daryl,



Sorry for this being a reply to a really old post. I am hoping this finds you and you have some more advice. I have been using the Oracle control for a couple of years and am looking for some help with a more advanced piece.



I need to get the position and/or selection a user makes in a word document that is loaded into the outside in viewer. I need this so that I can set a bookmark in the document based on the users selection point. I am trying to use the SetPositionToSelection(oixStart, oixEnd) method. I am having issues setting up the position object. Per the manual you have to connect to the position com object. Everything I have tried returns an error from the oracle control.



Have you ever accessed the position object? If so any advice on making this work?



Thanks.



Rick
  1. Helpful
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Sunday, 5 April 2020 06:35 AM UTC
  2. PowerBuilder
  3. # 3

Hi Rick,

did you try the new WebBrowser control?

It works great for majority of file types. Place it on your window and then just

wb_1.navigate(is_someurl) // can be web URL or local file

Best,

.m

Comment
  1. Armeen Mazda @Appeon
  2. Sunday, 5 April 2020 06:44 AM UTC
What a Marco mentioned is in PowerBuilder 2019 R2, which was released April 3, 2020. https://docs.appeon.com/appeon_online_help/pb2019r2/whats_new/ch01s05.html
  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.