![]() |
Oracle
COM Automation Developer's Guide
Release 8.1.5 for Windows NT A68012-01 |
|
This chapter describes how to use Oracle COM Automation feature
demos.
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 (for
example, 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 for
this demo to work properly.
To install the Microsoft Word demo:
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:
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;
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;
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;
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;
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 for
this demo to work properly.
To install the Microsoft Excel demo:
To run the Microsoft Excel demo:
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;
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;
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;
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.
|
![]() Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|