1. Ludwin Feiten
  2. PowerBuilder
  3. Monday, 9 September 2019 07:20 AM UTC

Hi all.

I show/preview word documents in my PowerBuilder app. Therefor I use an Olecontrol. (I use PB19.0 Win7/64 Word2013)

Unfortunately some documents do not fit into the control. So I want to set the zoom to “View.Zoom.PageFit”. I can’t find any documentation and tried a lot of different statements, but nothing work, yet.

Can anyone help me with the syntax?

TIA Ludwin

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 9 September 2019 14:39 PM UTC
  2. PowerBuilder
  3. # 1

Hi Ludwin;

  FWIW: I do not use the MS-Word OLE for this. In stead, I use either an RTE or RT DW for displaying the MS-Word doc. I use the OLE session to have MS-Word save the .Doc file as an .RTF and then use PB's native controls. I like the RT DW better as the DW can then scale & zoom it.

  Food for thought.

Regards ... Chris

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 9 September 2019 13:49 PM UTC
  2. PowerBuilder
  3. # 2

Hi, Ludwin - 

Here's a documentation link you may find helpful: MS Office Object Model Reference for Word

Good luck!

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 9 September 2019 08:29 AM UTC
  2. PowerBuilder
  3. # 3

Another thing I'm thinking of is that in Word your zoom / pagefit will be relevant to a certain "page size" like A4, not to the size of a control in which the document is displayed. 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 9 September 2019 08:26 AM UTC
  2. PowerBuilder
  3. # 4

Have you tried recording a Macro in Word and do those actions of preview and zoom, fit, etc.?

When you then stop the recording and edit the macro, you should find all the VBA syntax you can use with OLE in PB.

HIH

Comment
There are no comments made yet.
Ludwin Feiten Accepted Answer Pending Moderation
  1. Monday, 9 September 2019 08:07 AM UTC
  2. PowerBuilder
  3. # 5

Hi René,
thanks for the quick answer. But unfortunately "ole_word.ActiveWindow.View.Zoom.PageFit" does not compile. It seems that "ActiveWindow.View.Zoom.PageFit" will not compile with my OleControl.
It seens that "ActiveWindow.View.Zoom.PageFit" is only for OleObject.

Comment
  1. René Ullrich
  2. Monday, 9 September 2019 09:14 AM UTC
You have to use the object property: ole_word.object.ActiveWindow.View.Zoom.PageFit
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 9 September 2019 07:42 AM UTC
  2. PowerBuilder
  3. # 6

Hi Ludwin,

 

"View" is in Word a property of the "Window" object. In the OLE control you have a "Document" object.

So you may try ActiveWindow.View.Zoom.PageFit = 1

Valid Values for PageFit:

wdPageFitNone = 0
wdPageFitFullPage = 1
wdPageFitBestFit = 2
wdPageFitTextFit = 3

 

But this only works for "activated" OLE controls. If you have it only inactive I don't know a way how to change to preview. I know only the PowerBuilder property "SizeMode" of the OLE control.

 

HTH,

René

 

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.
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.