Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Format pic/drawing textbox in MS word using OLE

Former Member
0 Kudos

Hi All,

Am not able to draw textbox using OLE method CALL METHOD OF wordobj 'DrawTextbox'...

and not able to reduce the size of the picture inserted..

Can any one please tell me where i can find the documentation for the methods(in and out parameters)..

for formating picture am using ..

call method of wordobj 'FormatPicture'

exporting #1 = 1 "SetSize

#2 = '0 cm' "CropLeft

#3 = '0 cm' "CropRight

#4 = '0 cm' "CropTop

#5 = '0 cm' "CropBottom

#6 = '100%' "ScaleX

#7 = '100%' "ScaleY

#8 = '3.3 cm' "SizeX

#9 = '4.3 cm'. "SizeY

i have changed the size but still not changing...

can anyone please help..

We are using ECC 6.0.

Thanks

- Senthil Bala

Message was edited by: senthil bala

1 REPLY 1

former_member189059
Active Contributor
0 Kudos

Hi Senthil,

This is the code for textbox using OLE Word


*&---------------------------------------------------------------------*
*& Report  ZKRIS_OLE_WORD
*&
*&---------------------------------------------------------------------*
*& Written by : KRiS DoNAlD
*&
*&---------------------------------------------------------------------*

REPORT  ZKRIS_OLE_WORD.
  type-pools ole2 .

* word declarations
  data: application      type ole2_object.
  data: word             type ole2_object.
  data: documents        type ole2_object.
  data: newdoc           type ole2_object.
  data: actdoc           type ole2_object.
  data: selection        type ole2_object.
  data: shapes           type ole2_object.
  data: tbox             type ole2_object.
  data: tbox_sel         type ole2_object.
  data: tb_sel           type ole2_object.


*---------------------------------------------------------------------*
*                        Start of writing to Word            *
*---------------------------------------------------------------------*

  CREATE OBJECT word 'WORD.APPLICATION' .
  IF sy-subrc NE 0 .
    MESSAGE s000(su) WITH 'Error while creating OLE object!'.
    LEAVE PROGRAM .
  ENDIF .


  GET PROPERTY OF word 'documents' = documents.
  CALL METHOD OF documents 'Add' = newdoc.

  call method of newdoc 'Activate'.

*--Getting active document handle
  GET PROPERTY OF word 'activedocument' = actdoc .

*--Getting applications handle
  GET PROPERTY OF word 'Selection' = selection.

*--setting object's visibility property
  SET PROPERTY OF word 'visible' = '1' .

  call method of selection 'TypeText'
    exporting
    #1 = 'text before box'.

  GET PROPERTY OF actdoc 'Shapes' = shapes .

  call method of shapes 'AddTextbox' = tbox
  exporting
    #1 = 1
    #2 = '99'
    #3 = '90'
    #4 = '207'
    #5 = '153'.

  get property of tbox 'Select' = tb_sel.

   call method of selection 'TypeText'
    exporting
    #1 = 'Text in box'.