Oracle COM Automation Developer's Guide Release 8.1.6 for Windows NT Part Number A73027-01 |
|
This chapter describes how to use Oracle COM Automation feature demonstration programs. Specific topics discussed are:
Oracle COM Automation feature includes demos to give you an idea of how to use Oracle COM Automation feature to build solutions. These demos provide base functionality. They are provided as examples of how to use Oracle COM Automation feature and as a foundation upon which to build more customized, complex applications that use OLE Automation.
Each demo exposes a core set of APIs that enables you to do simple operations using OLE Automation. Each OLE Automation server, such as Word and Excel, provides more advanced capabilities than what is offered through the demo APIs. To take advantage of these advanced features, you must design and code your own PL/SQL procedures.
In this release, Oracle Corporation has provided the following demos:
The following sections describe how to install the Microsoft Word demo and the APIs that it exposes. This demo is provided as an example of the types of solutions that can be built with Oracle and Microsoft Word.
The Microsoft Word demo provides a PL/SQL package (ORDWord) that exposes several APIs for manipulating Microsoft Word. Also, the Microsoft Word demo includes a script to demonstrate the capabilities of exchanging data between Oracle and Microsoft Word. The worddem.sql
script exchanges data from the EMP table in Oracle to a Microsoft Word document.
Microsoft Word must be installed on the local computer before installing this demo.
To install the Microsoft Word demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
wordsol.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\WORDSOL.SQL
This script creates the ORDWord package in the current user's schema. You will receive several ORA-04043: object XXXX does not exist when you execute this script for the first time. These errors are normal.
To run the Microsoft Word demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
worddem.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\WORDDEM.SQL
This script creates a Microsoft Word document (worddemo.doc
) in the C:\
directory. The document contains data from the EMP table.
worddemo.doc
to see its contents.
The following subsections describe the APIs that the Microsoft Word demo exposes. These APIs are primitive. Be aware that much of the functionality that Microsoft Word exposes through OLE Automation is not exposed through these APIs. These APIs and PL/SQL code are provided as a proof of concept that Oracle COM Automation feature is a viable development feature.
Instantiates a `Word.Basic' object in the Microsoft Word Automation server.
FUNCTION CreateWordObject() RETURN BINARY_INTEGER;
This function must be called before any other operation can be performed. This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Creates a new Microsoft Word document.
FUNCTION FileNew() RETURN BINARY_INTEGER;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Loads a document into Microsoft Word.
FUNCTION FileLoad(filename VARCHAR2) RETURN BINARY_INTEGER;
where:
filename |
is the fully qualified file name of the document. |
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Saves the current active Microsoft Word document to disk.
FUNCTION FileSave() RETURN BINARY_INTEGER;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Saves the current active Microsoft Word document as a specific file.
FUNCTION FileSaveAs(filename VARCHAR2) RETURN BINARY_INTEGER;
where:
filename |
is the fully qualified file name of the document. |
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Closes the current active Microsoft Word document.
FUNCTION FileClose() RETURN BINARY_INTEGER;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Inserts a text string into the current active Microsoft Word document.
FUNCTION InsertText(textstr VARCHAR2) RETURN BINARY_INTEGER;
where:
textstr |
is the text that will be inserted into the document. |
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Inserts a carriage return into the current active Microsoft Word document.
FUNCTION InsertNewLine() RETURN BINARY_INTEGER;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Sets the font size for the current active Microsoft Word document.
FUNCTION FormatFontSize(fontsize BINARY_INTEGER) RETURN BINARY_INTEGER;
where:
fontsize |
is the point of the font. |
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
The following sections detail how to install the Microsoft Excel demo and describe the APIs that it exposes. This demo is provided as an example of the types of solutions that can be built with Oracle and Microsoft Excel.
The Microsoft Excel demo provides a PL/SQL package (ORDExcel) that exposes several APIs for manipulating Microsoft Excel. Also, the Microsoft Excel demo includes a script to demonstrate the capabilities of exchanging data between Oracle and Microsoft Excel. The exceldem.sql
script exchanges data from the EMP table in Oracle to a Microsoft Excel worksheet and puts it in a graph. Run this script after installing the demo.
Microsoft Excel must be installed on the local computer before installing this demo.
To install the Microsoft Excel demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
excelsol.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\EXCELSOL.SQL
This script creates the ORDExcel package in the current user's schema. You will receive several ORA-04043: object XXXX does not exist messages when you run this script for the first time. These messages are normal.
To run the Microsoft Excel demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
exceldem.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\EXCELDEM.SQL
This script creates a Microsoft Excel spreadsheet (excelxxxxx.xls
) in the C:\
directory. The document contains data from the EMP table.
excelxxxxx.xls
file, where xxxxx is a timestamp, to see its contents.
The following subsections describe the APIs that the Microsoft Excel demo exposes. These APIs are primitive. Be aware that much of the functionality that Microsoft Excel exposes through OLE Automation is not exposed through these APIs. These APIs and PL/SQL code are provided as a "proof of concept" that Oracle COM Automation feature is viable.
Starts the Microsoft Excel OLE Automation server and instantiates the objects for a workbook and a worksheet.
FUNCTION CreateExcelWorkSheet() RETURN BINARY_INTEGER;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Inserts any kind of data into a specific cell of the current active Excel worksheet.
FUNCTION InsertData(range VARCHAR2, data ANY PL/SQL DATATYPE, datatype VARCHAR2) RETURN BINARY_INTEGER;
where:
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Creates a chart of a specified range of data and inserts the chart at the x and y position of the current worksheet with the desired height and width.
FUNCTION InsertChart(xpos BINARY_INTEGER, ypos BINARY_INTEGER, width BINARY_ INTEGER, height BINARY_INTEGER, range VARCHAR2, type VARCHAR2) RETURN BINARY_ INTEGER;
where:
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Saves the current active Microsoft Excel workbook as a specific file.
FUNCTION SaveExcelFile(filename VARCHAR2) RETURN BINARY_INTEGER;
where:
filename |
is the fully qualified file name of the Excel workbook. |
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Performs some cleanup and destroys the outstanding references to the Excel OLE Automation server. This should be the last API called.
FUNCTION ExitExcel() RETURN BINARY_INTEGER;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
The following sections detail how to install the Microsoft PowerPoint demo and describe the APIs that it exposes. This demo is provided as an example of the types of solutions that can be built with Oracle and Microsoft PowerPoint.
The Microsoft PowerPoint demo provides a PL/SQL package (ORDPPT) that exposes several APIs for manipulating Microsoft PowerPoint. Also, the Microsoft PowerPoint demo includes a script (pptdem.sql
) to demonstrate the capabilities of exchanging data between Oracle and Microsoft PowerPoint. Run this script after installing the demo.
Microsoft PowerPoint97 must be installed on the local computer before installing this demo.
To install the Microsoft PowerPoint demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
pptsol.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\PPTSOL.SQL
This script creates the ORDPPT package in the current user's schema. You will receive several ORA-04043: object XXXX does not exist messages when you run this script for the first time. These messages are normal.
To run the Microsoft PowerPoint demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
pptdem.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\PPTDEM.SQL
This script creates a Microsoft PowerPoint presentation (pptdemo.ppt
) on C:\. The document contains a list of table names owned by the user account, such as SCOTT.
pptdemo.ppt
to see its contents.
The following subsections describe the APIs that the Microsoft PowerPoint demo exposes. These APIs are primitive. Be aware that much of the functionality that Microsoft PowerPoint exposes through OLE Automation is not exposed through these APIs. These APIs and PL/SQL code are provided as a "proof of concept" that Oracle COM Automation feature is viable.
Starts the Microsoft PowerPoint OLE Automation server and instantiates the objects for a presentation.
FUNCTION CreatePresentation (servername IN varchar2) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Inserts a new slide in the PowerPoint presentation.
FUNCTION AddSlide (layout IN binary_integer) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Specifies the title of the PowerPoint slide.
FUNCTION SetTitle (title IN varchar2) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Inserts text into the specified location on the slide.
FUNCTION InsertText (orientation IN binary_integer, left IN binary_integer, top IN binary_integer, width IN binary_integer, height IN binary_integer, text IN VARCHAR2) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Save the current PowerPoint presentation.
FUNCTION PresentationSave RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Saves the current presentation using the specified name.
FUNCTION PresentationSaveAs (filename IN varchar2) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Closes the current PowerPoint presentation.
FUNCTION PresentationClose RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Exits the PowerPoint program.
FUNCTION Exit RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
The following sections detail how to install the MAPI demo and describe the APIs that it exposes. This demo is provided as an example of the types of solutions that can be built with Oracle and Messaging Application Programming Interface (MAPI) compliant applications.
The MAPI demo provides a PL/SQL package (ORDMAPI) that exposes several APIs for manipulating MAPI. Also, the MAPI demo includes a script (mapidem.sql
) to demonstrate the capabilities of exchanging data between Oracle and MAPI. Run this script after installing the demo.
The MAPI application, such as MS Outlook 98 or Oracle InterOffice, must be installed on the local computer before installing this demo.
To install the MAPI demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
mapisol.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\MAPISOL.SQL
This script creates the ORDMAPI package in the current user's schema. You will receive several ORA-04043: object XXXX does not exist messages when you run this script for the first time. These messages are normal.
To run the MAPI demo, perform the following steps:
C:\> cd oracle_base\oracle_home\com\demos
C:\> svrmgrl
SVRMGR> CONNECT SCOTT/TIGER
mapidem.sql
script at the Server Manager prompt:
SVRMGR> @ORACLE_BASE\ORACLE_HOME\COM\DEMOS\MAPIDEM.SQL
This script connects to an Oracle database, extracts the data, and sends an email to a specified recipient.
The following subsections describe the APIs that the MAPI demo exposes. These APIs are primitive. Be aware that much of the functionality that MAPI exposes through OLE Automation is not exposed through these APIs. These APIs and PL/SQL code are provided as a "proof of concept" that Oracle COM Automation feature is viable.
Starts the MAPI OLE Automation server and instantiates the objects for a session.
FUNCTION CreateMAPISession (servername IN varchar2 DEFAULT '', profilename IN varchar2 DEFAULT NULL, password IN varchar2 DEFAULT NULL) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Creates a new message.
FUNCTION NewMessage RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Adds the email address of a recipient. These are addresses where the email message will be sent.
FUNCTION AddRecipient (emailaddress varchar2) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Specifies the subject of the email message.
FUNCTION SetSubject (subject varchar2) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Inserts the body text of the email message.
FUNCTION SetBody (messagetext varchar2) RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Sends the email message to the specified recipients.
FUNCTION SendMessage RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
Exits the MAPI session.
FUNCTION EndMAPISession RETURN binary_integer;
This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|