<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Powerpoint.Application in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679686#M1100435</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this.. here I'm currently opening a powerpoint file which could contain the template you require&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZKRIS_OLE_OPEN_ppt_ADD_DATA
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Author  : Kris Donald
*&amp;amp; Date    : 10-02-2009
*&amp;amp; Purpose : Find some text in ppt and replace it
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Date Changed by Tag Description
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZKRIS_OLE_OPEN_ppt_ADD_DATA.

selection-screen begin of block b1 with frame title ft1.
parameters p_story(256) default 'C:\test.ppt' lower case.
selection-screen end of block b1.

initialization.
ft1 = 'Template file'.

start-of-selection.

type-pools ole2 .

* ppt declarations
data: application      type ole2_object.
data: ppt              type ole2_object.
data: presentations    type ole2_object.
data: newdoc           type ole2_object.
data: actwin           type ole2_object.
data: actpres          type ole2_object.
data: selection        type ole2_object.
data: sliderange       type ole2_object.
data: shapes           type ole2_object.
data: textbox          type ole2_object.
data: textrange1       type ole2_object.
data: textframe        type ole2_object.
data: shaperange1      type ole2_object.
data: shaperange2      type ole2_object.
data: shaperange3      type ole2_object.
data: view             type ole2_object.
data: font             type ole2_object.
data: paraformat       type ole2_object.
data: color            type ole2_object.
data: slides           type ole2_object.


data: slideindex       type i.
data: slidecount       type i.
slidecount = 1.


data: begin of wa_data,
  line(256),
  end of wa_data,
  it_data like table of wa_data.


*--create the ppt application
CREATE OBJECT ppt 'POWERPOINT.APPLICATION' .
IF sy-subrc NE 0 .
  MESSAGE s000(su) WITH 'Error while creating OLE object!'.
  LEAVE PROGRAM .
ENDIF .

*--setting object's visibility property
SET PROPERTY OF ppt 'visible' = '1' .

*--open the specified file from presentation server
GET PROPERTY OF ppt 'presentations' = presentations.
CALL METHOD OF presentations 'Open'
  EXPORTING
  #1 = p_story.

*--Getting active window handle
GET PROPERTY OF ppt 'ActiveWindow' = actwin .

*--Getting active presentation handle
GET PROPERTY OF ppt 'ActivePresentation' = actpres .


* add some text
wa_data = 'This is some text'.
append wa_data to it_data.

data: lv_subrc like sy-subrc.
CALL METHOD CL_GUI_FRONTEND_SERVICES=&amp;gt;CLIPBOARD_EXPORT
  IMPORTING
    DATA                 = it_data[]
  CHANGING
    RC                   = lv_subrc
  EXCEPTIONS
    CNTL_ERROR           = 1
    ERROR_NO_GUI         = 2
    NOT_SUPPORTED_BY_GUI = 3
    others               = 4
        .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

get property of actwin 'View' = view.
CALL METHOD OF view 'Paste'.

GET PROPERTY OF actwin 'Selection' = selection.
GET PROPERTY OF selection 'ShapeRange' = shaperange1.

* move text
CALL METHOD OF SHAPERANGE1 'IncrementLeft'
  EXPORTING
    #1 = '-200'.
CALL METHOD OF SHAPERANGE1 'IncrementTop'
  EXPORTING
    #1 = '-150'.


* change font
GET PROPERTY OF actwin 'Selection' = selection.
GET PROPERTY OF shaperange1 'TextFrame' = textframe.
GET PROPERTY OF textframe 'TextRange' = textrange1.

GET PROPERTY OF textrange1 'Font' = font.
set property of font 'Size' = '36'.
set property of font 'Name' = 'Arial'.

* change font color
get property of font 'Color' = color.
set property of color 'SchemeColor' = 6.

* center align the object
GET PROPERTY OF textrange1 'ParagraphFormat' = paraformat.
set property of paraformat 'Alignment' = 2.

* add a slide
GET PROPERTY OF actpres 'Slides' = slides.

slidecount = slidecount + 1.
CALL METHOD OF slides 'Add'
  EXPORTING
    #1 = slidecount
    #2 = 12.

* go to the added slide
get property of actwin 'View' = view.
call method of view 'GotoSlide'
  exporting
    #1 = slidecount.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Feb 2009 12:11:53 GMT</pubDate>
    <dc:creator>former_member189059</dc:creator>
    <dc:date>2009-02-12T12:11:53Z</dc:date>
    <item>
      <title>Powerpoint.Application</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679685#M1100434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    I have a requirement to print the report in a power point template and mail to the users ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   So I found like this is possible with the OLE application '&lt;STRONG&gt;Powerpoint.Application&lt;/STRONG&gt;' but I am not able to find any examples for this , Can some one PL. send me a small Example of this so that I can elaborate on that ......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   And Let me know if any other way is possible in SAP for this .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Girish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2008 12:18:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679685#M1100434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-17T12:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Powerpoint.Application</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679686#M1100435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this.. here I'm currently opening a powerpoint file which could contain the template you require&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZKRIS_OLE_OPEN_ppt_ADD_DATA
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Author  : Kris Donald
*&amp;amp; Date    : 10-02-2009
*&amp;amp; Purpose : Find some text in ppt and replace it
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Date Changed by Tag Description
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZKRIS_OLE_OPEN_ppt_ADD_DATA.

selection-screen begin of block b1 with frame title ft1.
parameters p_story(256) default 'C:\test.ppt' lower case.
selection-screen end of block b1.

initialization.
ft1 = 'Template file'.

start-of-selection.

type-pools ole2 .

* ppt declarations
data: application      type ole2_object.
data: ppt              type ole2_object.
data: presentations    type ole2_object.
data: newdoc           type ole2_object.
data: actwin           type ole2_object.
data: actpres          type ole2_object.
data: selection        type ole2_object.
data: sliderange       type ole2_object.
data: shapes           type ole2_object.
data: textbox          type ole2_object.
data: textrange1       type ole2_object.
data: textframe        type ole2_object.
data: shaperange1      type ole2_object.
data: shaperange2      type ole2_object.
data: shaperange3      type ole2_object.
data: view             type ole2_object.
data: font             type ole2_object.
data: paraformat       type ole2_object.
data: color            type ole2_object.
data: slides           type ole2_object.


data: slideindex       type i.
data: slidecount       type i.
slidecount = 1.


data: begin of wa_data,
  line(256),
  end of wa_data,
  it_data like table of wa_data.


*--create the ppt application
CREATE OBJECT ppt 'POWERPOINT.APPLICATION' .
IF sy-subrc NE 0 .
  MESSAGE s000(su) WITH 'Error while creating OLE object!'.
  LEAVE PROGRAM .
ENDIF .

*--setting object's visibility property
SET PROPERTY OF ppt 'visible' = '1' .

*--open the specified file from presentation server
GET PROPERTY OF ppt 'presentations' = presentations.
CALL METHOD OF presentations 'Open'
  EXPORTING
  #1 = p_story.

*--Getting active window handle
GET PROPERTY OF ppt 'ActiveWindow' = actwin .

*--Getting active presentation handle
GET PROPERTY OF ppt 'ActivePresentation' = actpres .


* add some text
wa_data = 'This is some text'.
append wa_data to it_data.

data: lv_subrc like sy-subrc.
CALL METHOD CL_GUI_FRONTEND_SERVICES=&amp;gt;CLIPBOARD_EXPORT
  IMPORTING
    DATA                 = it_data[]
  CHANGING
    RC                   = lv_subrc
  EXCEPTIONS
    CNTL_ERROR           = 1
    ERROR_NO_GUI         = 2
    NOT_SUPPORTED_BY_GUI = 3
    others               = 4
        .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

get property of actwin 'View' = view.
CALL METHOD OF view 'Paste'.

GET PROPERTY OF actwin 'Selection' = selection.
GET PROPERTY OF selection 'ShapeRange' = shaperange1.

* move text
CALL METHOD OF SHAPERANGE1 'IncrementLeft'
  EXPORTING
    #1 = '-200'.
CALL METHOD OF SHAPERANGE1 'IncrementTop'
  EXPORTING
    #1 = '-150'.


* change font
GET PROPERTY OF actwin 'Selection' = selection.
GET PROPERTY OF shaperange1 'TextFrame' = textframe.
GET PROPERTY OF textframe 'TextRange' = textrange1.

GET PROPERTY OF textrange1 'Font' = font.
set property of font 'Size' = '36'.
set property of font 'Name' = 'Arial'.

* change font color
get property of font 'Color' = color.
set property of color 'SchemeColor' = 6.

* center align the object
GET PROPERTY OF textrange1 'ParagraphFormat' = paraformat.
set property of paraformat 'Alignment' = 2.

* add a slide
GET PROPERTY OF actpres 'Slides' = slides.

slidecount = slidecount + 1.
CALL METHOD OF slides 'Add'
  EXPORTING
    #1 = slidecount
    #2 = 12.

* go to the added slide
get property of actwin 'View' = view.
call method of view 'GotoSlide'
  exporting
    #1 = slidecount.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2009 12:11:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679686#M1100435</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2009-02-12T12:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Powerpoint.Application</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679687#M1100436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Mar 2014 06:01:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679687#M1100436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-03-30T06:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Powerpoint.Application</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679688#M1100437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Mar 2014 06:02:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/powerpoint-application/m-p/4679688#M1100437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-03-30T06:02:47Z</dc:date>
    </item>
  </channel>
</rss>

