1. Ludwin Feiten
  2. PowerBuilder
  3. Monday, 09 September 2019

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 Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Monday, 9 September 2019
  2. PowerBuilder
  3. # 1
John Fauss Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Monday, 9 September 2019
  2. PowerBuilder
  3. # 2
Miguel Leeuwe Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Monday, 9 September 2019
  2. PowerBuilder
  3. # 3
Miguel Leeuwe Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Monday, 9 September 2019
  2. PowerBuilder
  3. # 4
Ludwin Feiten Accepted Answer Pending Moderation
0
Votes
Undo

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
You have to use the object property: ole_word.object.ActiveWindow.View.Zoom.PageFit
  1. René Ullrich
  2. Monday, 9 September 2019
There are no comments made yet.
  1. Monday, 9 September 2019
  2. PowerBuilder
  3. # 5
René Ullrich Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Monday, 9 September 2019
  2. PowerBuilder
  3. # 6
  • Page :
  • 1


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