CapeSoft.Com
Clarion Accessories
Office Inside
Documentation
PowerPoint
CapeSoft Logo

CapeSoft Office Inside
PowerPoint Documentation

Download Latest Version History
Installed Version Latest Version

Templates

Add_MSPowerPoint_Object

Summary

Procedure Extension Template
Add an MS PowerPoint object to a procedure
Optional

What does it do?

This template is used to add MS PowerPoint functionality to a procedure in your app. We are still developing it and adding functionality to it, more info will come later.

Prerequisites

You need to have added the Activate_Office_Inside global extension template before you can add this template to a procedure.

How do I implement it?

  1. Select the procedure which you want to add this template to.
  2. Select "Properties..." from the "Edit" menu
  3. Click the "Extensions" button
  4. Click on the "Insert" button to add a new extension template
  5. Select "Add_MSPowerPoint_Object" ( found under the "Class OfficeInside" group )
  6. Click "Select", then "OK", then "OK" again...
What are my options?

General Tab:

Object Name:

This is the name of the Office Inside object that this template will create and implement. Typically this would default to 'MyPowerPoint1', but you can change it if you would prefer to call the object something else.

Classes

This section describes the various classes which make up "Office Inside". Each class contains methods and properties, which are documented below. Each method is documented by giving the method name, the parameters, an example of how to code the method, a list describing what the method does, and additional comments below.

The oiPowerPoint Class - Introduction

The oiPowerPoint class is a "wrapper" class, which is used by the templates and by other classes as the "communication" layer between Office Inside and MS PowerPoint.  Should you wish to write code which communicates "directly" with MS PowerPoint, this is the class you're looking for.

The oiPowerPoint Class - Methods

oiPowerpoint Method Reference
MethodDescription
ClosePresentationCloses the currently open presentation
CountOpenPresentationsReturns the number of open presentations
EndShowEnds a slidehow
FirstSlideMoves to the first slide in a show
GetInfoRetrieves properties of the slideshow or Powerpoint
InitInitialises the oiPowerpoint object and Powerpoint
KillCleans up and releases the instance of Powerpoint
LastSlideNavigates to the last slide in the show
NextSlideNavigates to the next slide
OpenPresentationOpens a Powerpoint presentation
PreviousSlideNavigates to the previous slide
SaveAsSaves the presentation to file, in a number of formats
ViewShowStarts a show

ClosePresentation

ClosePresentation ( ) ,byte,proc

Description

Closes the currently open presentation.

Example

MyPowerPoint.ClosePresentation ()

CountOpenPresentations

CountOpenPresentations ( ) ,long

Description

Returns the number of currently open presentations.

Example

if MyPowerPoint.CountOpenPresentations() > 0
...

EndShow

EndShow ( )

Description

If you are currently viewing a presentation, this method will stop it.

Example

MyPowerPoint.EndShow()

FirstSlide

FirstSlide ( )

Description

If you are currently viewing a presentation, this method will load the first slide.

Example

MyPowerPoint.FirstSlide()

GetInfo

GetInfo ( byte pOption ) ,string,proc

Description

Used to get information from the Power Point object.

Example

i# = MyPowerPoint.GetInfo(oip:Width)

Init

Init ( byte pStartVisible=1, byte pEnableEvents=1 ) ,byte,proc

Description
Example

MyPowerPoint.Init (true, false)

Kill

Kill ( byte pUnloadCOM=1 ) ,byte,proc

Description

Closes down and disposes of the PowerPoint object, as well as the numerous objects used internally by the PowerPoint object. The templates will generate code to call this method.

Example

MyPowerPoint.Kill()

LastSlide

LastSlide ( )

Description

If you are currently viewing a presentation, this method will load the last slide.

Example

MyPowerPoint.LastSlide()

NextSlide

NextSlide ( )

Description

If you are currently viewing a presentation, this method will load the next slide in sequence.

Example

MyPowerPoint.NextSlide()

OpenPresentation

OpenPresentation ( string pFileName, byte pReadOnly=1 ) ,byte,proc

Description

Opens a Power Point presentation, as specified by the pFileNameparameter.

Example

MyPowerPoint.OpenPresentation (longpath() & '\csoi.ppt')

PreviousSlide

PreviousSlide ( )

Description

If you are currently viewing a presentation, this method will load the previous slide in sequence.

Example

MyPowerPoint.PreviousSlide()

SaveAs

SaveAs (string fileName, longfileFormat, long embedFonts), long

Description

The SaveAs method saves the currently loaded and active presentation to a file. The file name and type can both be specified. PowerPoint supports saving as a large variety of files, although not all formats support all the data that can be stored in a presentation. For example you can export the summary to RTF by using SaveAs and setting the fileFormat parameter to oip:ppSaveAsRTF.

Parameters
Parameter Description
fileName the file name to save the document as (for example 'PowerPoint Outline.rtf')'
fileFormat the format to save the file as (see below for the values allowed for this parameter)
embedFonts whether to embed fonts into the new document (only applies to formats that allow font embedding)
The supported values for the fileFormat parameter are:
Equate and value Description
oip:ppSaveAsPresentation       equate(1) 
oip:ppSaveAsPowerPoint7 equate(2)
oip:ppSaveAsPowerPoint4 equate(3) oip:ppSaveAsPowerPoint3 equate(4)
oip:ppSaveAsTemplate equate(5)
oip:ppSaveAsRTF equate(6)
oip:ppSaveAsShow equate(7)
oip:ppSaveAsAddIn equate(8)
oip:ppSaveAsPowerPoint4FarEast equate(10)
oip:ppSaveAsDefault equate(11)
oip:ppSaveAsHTML equate(12)
oip:ppSaveAsHTMLv3 equate(13)
oip:ppSaveAsHTMLDual equate(14)
oip:ppSaveAsMetaFile equate(15)
oip:ppSaveAsGIF equate(16)
oip:ppSaveAsJPG equate(17)
oip:ppSaveAsPNG equate(18)
oip:ppSaveAsBMP equate(19)
oip:ppSaveAsWebArchive equate(20)
oip:ppSaveAsTIF equate(21)
oip:ppSaveAsPresForReview equate(22)
oip:ppSaveAsEMF equate(23)
Presentation (a standard PowerPoint .ppt file)
PowerPoint 7 Presentation (.ppt)
PowerPoint 4 Presentation (.ppt)
PowerPoint 3 Presentation (.ppt)
PowerPoint Template (.pot)
Outline/RTF (.rtf)
PowerPoint Show (.pps)
PowerPoint Add-In ( .ppa)
-
-
Web Page (.htm; .html )
Web Page (.htm; .html )
-
Windows Metafile (.wmf)
GIF Graphics Interchange Format (.gif)
JPEG File Interchange Format (.jpg')
PNG Portable Network Graphics Format (.png)
Device Independant Bitmap (.bmp)
Single File Web Page (.mht; .mhtml)
Tagged Image File Format (.tiff)
-
Enhanced Metafile (.emf)
Return Values

The function returns 1 (true) for success and zero (false) for failure,

Simple Example
MyPowerPoint1.SaveAs ((LongPath() & '\Test.ppt'), oip:ppSaveAsPresentation, true)
Full Example

The below example displays a File Dialog for choosing the file name and type (if the user does not enter the file extension then it is appended to the name for them). The extension is then checked and the SaveAs method is called with the fileFormat parameter set to the equate that matches the selected file type. Not that for document with multiple pages selecting an image format such as Bitmap, JPEG, PNG etc. will create a folder with an image for each page. The folder is given the same name as the filename specified in the Save As dialog box. See the DemoC6 example which contains this code.
Example
fileFormats         string(512)                         ! String containing the file formats string for a filedialog
fileName string(File:MaxFilename) ! String to store the file name
fileType long ! The file type, one of the supported equates
i long ! Loop counter fileFormats = 'Presentation |*.ppt |Design Template |*.pot |Show |*.pps |PowerPoint Add-In |*.ppa |' | & 'Web Page |*.htm |Single File Web Page |*.mht |GIF Graphics Interchange Format |*.gif |' | & 'PNG Portable Network Graphics Format |*.png |JPEG File Interchange Format |*.jpg |' | & 'Device Independant Bitmap |*.bmp |Windows Metafile |*.wmf |Enhanced Metafile |*.emf |Outline(RTF) |*.rtf |All Files |*.*' if FileDialog('Save As...', fileName, fileFormats , File:Save + File:KeepDir + File:AddExtension + File:LongName) ! Get the file extention so that we can tell which type of file is needed loop i = Len(Clip(fileName)) to 1 by -1 if fileName[i] = '.' ! found the extension position case( Lower( fileName[i + 1 : Len(Clip(fileName))] ) ) of 'ppt' fileType = oip:ppSaveAsPresentation of 'pot' fileType = oip:ppSaveAsTemplate of 'pps' fileType = oip:ppSaveAsShow of 'ppa' fileType = oip:ppSaveAsAddIn of 'htm' orof 'html' fileType = oip:ppSaveAsHTML of 'mht' orof 'mhtml' fileType = oip:ppSaveAsWebArchive of 'gif' fileType =oip:ppSaveAsGIF of 'png' fileType = oip:ppSaveAsPNG of 'jpg' orof 'jpeg' fileType = oip:ppSaveAsJPG of 'bmp' fileType = oip:ppSaveAsBMP of 'wmf' fileType = oip:ppSaveAsMetaFile of 'emf' fileType = oip:ppSaveAsEMF of 'rtf' fileType = oip:ppSaveAsRTF else Message('Sorry but an unknown or invalid file type was specified (' & Lower( fileName[i + 1 : Len(Clip(fileName))] ) & ').') break end if not MyPowerPoint1.SaveAs (Clip(fileName), fileType, false) Message('Failed to save document') else Message('Document saved to: ' & Clip(fileName)) end end end end

ViewShow

ViewShow ( )

Description

Once you have opened a Power Point presentation, you can use this method to start viewing the Slide Show.

Example

MyPowerPoint.ViewShow ()

The oiPowerPoint Class - Equates

( See oiOfficeInside.inc )