Using COM automation in 10.2XE
Hello -
I was reading the COM Automation documentation for 10.2 with some interest, and was wondering if there was an implementation of this for XE?
Alternately, is there somewhere I can get hold of the SQL script that implements the capability?
Thanks -
Dave
Hi
Please look into the document:
Oracle® Database Express Edition
Licensing Information
10g Release 2 (10.2)
Part Number B25456-02
section: 2.2 Application Development, Language, and Database Features
link: http://download-uk.oracle.com/docs/cd/B25329_01/doc/license.102/b25456/toc.htm
to understand the availability of COM features in Oracle Database XE.
-Priyanka
Similar Messages
-
Using COM automation to provide data to LabVIEW
Does LabVIEW have a defined (or recommended) interface it would use to get
real-time data from a 3rd party source? We have a proprietary data
acquisition system which we would like to wrap with COM automation objects.
We would like if these objects could be used by LabVIEW.
Thank you.LabVIEW 5.x has a new functionaly that handles COM objects (exe, dll,
and ocx). See Excel examples in the online help.
Makoto
Mat Kramer wrote in message <8d5i4m$1os9$[email protected]>...
>Does LabVIEW have a defined (or recommended) interface it would use to get
>real-time data from a 3rd party source? We have a proprietary data
>acquisition system which we would like to wrap with COM automation objects.
>We would like if these objects could be used by LabVIEW.
>
>Thank you.
>
>
> -
Error with TDM add-in using COM automation ImportFile
The importer works fine within Excel. However, when using automation from within LabVIEW I keep getting error "-2147417851" on the output of method "ImportFile".
Code snippet below.
The PC I'm using has...
OS = Windows 7
Excel 2010, all latest service packs and Office updates.
LabVIEW 2009
TDM for Excel Add-In v.3.5.1
The exact same calls work on another computer with the following:
OS = Windows XP
Excel 2007, all latest service packs and Office updates.
LabVIEW 2009
TDM for Excel Add-In v.3.5.1
Can't seem to find any docs or reason for it not to work. The libraries show up as registered from the dropdowns. The Importer works from within Excel. I've rebooted updated and reinstalled and rebooted what feels like a million times already. What am I missing here? Any ideas?
Solved!
Go to Solution.Mavis: Thank you not only for a meaningful reply , but the actual solution!
A small detail: I found that I could not disconnect right away or I'd get another error - waiting to disconnect until after I had a chance to save the file ensured that it was fully loaded.
Is this documented somewhere? The VBA code example on this page http://www.ni.com/white-paper/10207/en/rating/2 shows the call to connect, but there doestn' see m to be any doc on the method.
Also, this solution begs the question: how did the code with the earlier version of the add-in work correctly without specifically calling 'connect' first? I'm sure someone will say it doesnt' matter, but that's what threw me for a loop all along; it might very well matter to the next person that runs into the same problem. Worked in Case A, how is Case B different?
Thanks again, Mav.
Can I call you Mav? -
We are getting an Error Unable to Open IPC Connection while using COM Automation feature of Oracle 8i.
As specified in the documentation Listener.ora and TNSNames.ora are configured. The listener process is also running properly. But, still we are gettin this problem. What do we do?.
Domain Name : BSSL
Database Name : SATS
SID : SATS
TNSNames.ORA
===========
# D:\ORACLE\ORA81\NETWORK\ADMIN\TNSNAMES.ORA Configuration File:D:\Oracle\Ora81\network\admin\tnsnames.ora
# Generated by Oracle Net8 Assistant
EXTPROC_CONNECTION_DATA.BSSL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
SATS.BSSL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmk)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = SATS)
Config.ORA
==========
# D:\ORACLE\ORA81\NETWORK\ADMIN\LISTENER.ORA Configuration File:D:\Oracle\Ora81\network\admin\listener.ora
# Generated by Oracle Net8 Assistant
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmk)(PORT = 1521))
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
(ADDRESS = (PROTOCOL = TCP)(HOST = vmk)(PORT = 2481))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\Oracle\Ora81)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = SATS)
(ORACLE_HOME = D:\Oracle\Ora81)
(SID_NAME = SATS)
After Installing Oracle, If we get this error, is the only solution Re-installing Oracle? Often this is troubling with this error? Can we rely on this option and continue to use Oracle COM Automation feature in our Application?
Please suggest.
My mail id:
[email protected]
[email protected]
nullcan we use this COM Automation with Oracle 9i Application server
and Oracle 8i database?
Please help me.
Thanks in advance.
Saravanan -
Word 2013 COM automation fails to open file when offline
I'm getting a weird error the I'm guessing may be related to OneDrive integration in Word 2013.
I've got a Python script that uses COM Automation to get Word to open a .DOC/.DOCX file (the script should then paste something into the very first line, save the document, and close it). When I'm online everything works great. While
using Word 2010 everything worked great, online and offline.
When I'm on the bus (and, therefore, offline - there's no WiFi/Clearwire/etc for my laptop) the script fails, and it fails specifically at the line where I try to do the following:
wordapp.Documents.Open("path_To_File\file.doc");
The directory that contains the file is in OneDrive; it is marked as being "Available Offline".
My guess is that when Word 2013 is not on a network it's having trouble with the OneDrive integration.
I'd love any advice on either fixing this or what to look for next to better diagnose this problem.Hi,
This issue more about Script, if you want more profession suggestion, please post it in TechNet Script Forum.
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Greta Ge CHN
TechNet Community Support -
FAULT: COM Automation with long strings
Does anyone know if you can use COM Automation to call COM objects that return string longer than 255.
We have a problem in that when we call a method that returns a string longer than 255 chars it truncates it. The documentation says that you pass in a Varchar2.
I have tested the COM object from VB and it does not truncate it.Hello eugene2,
I get the same problem.
Did you get a solution ?
Thanks in advance
Gamiet -
How to insert a picture into excel file using ALE AUTOMATION
Hi every body,
I have to write report that export data from abap to exel the data contain a logo but I don't know how to insert picture to excel using ALE AUTOMATION.
Please help me!
Thank you!Hi,
you have to join into SAP Code Exchange and download this zip:
[ABAP2XLSX_daily.nugg.zip|http://code.sdn.sap.com/spaces/abap2xlsx/documents/btFzHQ3vKr36tCeJe7bhNc/download/btFzHQ3vKr36tCeJe7bhNc]
Regards,
Ivan -
How to get windows form object of a MMC snapin node using MMC automation object model
Hello,
I am using automation object model for an existing mmc file and just trying to traverse all nodes of it. And i am able to do so.
My query is : how can i get the access of windows form object of a particular node . Windows form is present in result pane of a node, i want to get access of that so that i can perform some automation on that form.
http://msdn.microsoft.com/en-us/library/aa815049(v=vs.85).aspx
I found that if OCX control is in result view of any node, then "view object -> control object property" returns
the automation interface supplied by the control in the result view.
However, if result view is HTML view then how to get the automation interface of that result
view.
Thanks in advance,
SumitHi Sumit,
I read the link you provide above. It seems that when you want to achieve your target by using MMC automation
object model, you need to use codes. Based on the programming language, if use VB, I suggest you post the question in
VB Forum. If you want to use C#, may post in
C# Forum.
In addition, there is an answered question, may help you to find the correct forum.
MMC development forum?
http://social.microsoft.com/Forums/en-US/3796a8e9-674e-4da0-a40e-4e4b69575c8e/mmc-development-forum?forum=whatforum
Since, it’s more related to development. We may can’t provide some more detailed information. Thanks for your
understanding.
Hope this helps.
Best regards,
Justin Gu -
PL/SQL COMWRAP.SQL COM Automation in Windows
Hello All,
Mike here. I'm not sure which forum this should go in so I put it here.
I'm writing a pl/sql procedure that calls ordcom (create by comwrap.sql) which uses orawpcom11.dll to work with com automation objects on windows. It appears that there is a limit on the amount of data that can be passed back to Oracle (approx. 34kb stored as a file). My best guess is that comwrap.sql doesn't provide for returned text steams that are larger than that provided by varchar2 in pl/sql. I tried adding to the comwrap.sql to have clob as a return type but that does not work.
I am attempting to get back XML from a Windows component (SDK to Quickbooks) that I can then store in an XMLType table. This works when all of the returned XML (from the SDK com object) stays under 34kb (stored as a file). If I remember correctly, 33950 characters are returned at the maximum. Of course, when the XML should be longer, I can't store it because it is not correctly formed XML (incomplete).
Does anyone know what is occuring and a way to get around this? Any help is appreciated.
Thanks,
MikeThe actual size is 32767 bytes Mike. And I'm not sure what happened to the last byte to make it 32768 and exactly 32KB. ;-)
You cannot change a varchar2 data type for a clob data type. These two types are quite different when it comes to memory allocation and management of variables of that type. These methods are incompatible. Essentially a clob variable is a "locator variable" (aka lob locator). Just another word for a pointer.
Declaring a clob variable is simply defining a pointer variable that, as yet, points to nothing. The clob needs to be created, memory allocated, and the point/locator must be set to this chunk of clob memory allocated.
Declaring a varchar2 variable results in the compiler doing the actual work at compilation time - reserving space for that variable and setting that variable's address to this preallocated space.
In terms of client-server, this a tad more complex. The data sits in the client. The data must be passed to the server. So there is a client variable. There is a server variable. And the content of one needs to be copied/pushed/transferred somehow from client variable to server variable.
Windows supports a set of data types. Oracle supports a different set. Why? Despite Oracle on Windows, Oracle also runs on something like a 100 other operating systems too. There are endian issues. CPUs dealing differently with reals and floats and integers. Oracle has thus its own abstraction layer and implement is own consistent set of data types - across all platforms.
So when pushing data from a client variable (like a COM object var) into a server variable (like a CLOB), it is not as simple as "copy-and-paste".
PL/SQL "understand" basic Windows data types like zero terminated strings - which it can accept into varchar2 variables. But as PL/SQL has a 32KB (less one byte) varchar2 limit, it cannot accept a huge Windows string (or data stream). And getting that to work via a clob, very likeky requires changes in the interface between client and server that does this transfer of data.
It requires more than just changing the server variable's data type from varchar2 into a clob, unfortunately. You will need to read up on Oracle's EXTPROC interface (I expect this is what is being used to interface with COM objects?) to see how to deal with LOB data types in this respect. -
Oracle COM Automation Excel Charts
Hi All
I read and manged to get all the COM Demos working from the COM Automation Feature Developer's Guide <http://www.oracle.com/pls/db102/to_toc?pathname=win.102%2Fb14310%2Ftoc.htm&remark=portal+%28Windows%29>.
I have changed the Excel Demo to match what I want to use in my Database. Everything works great except the Excel Chart portion. I what to have Chart Type line but when I use xlLine, the chart still produces a bar chart.
Does anyone know how to produce a Line Chart in Excel using Oracle COM Automation?
I am using Windows Server 2003, Office Standard Edition 2003, and Oracle 10.2
My modified sql is
<pre>
set serveroutput on;
declare
CURSOR c1 IS
SELECT time, flow
FROM RT_FLOW_TEST
WHERE time > to_date('31-dec-2006','dd-mon-yyyy')
ORDER BY time;
error_message varchar2(1200);
n binary_integer:=2;
i binary_integer;
filename varchar2(255);
cellIndex varchar2(40);
cellValue varchar2(40);
cellColumn varchar2(10);
returnedTime varchar2(20);
currencyvalue double precision;
datevalue DATE;
looptext varchar2(20);
error_src varchar2(255);
error_description varchar2(255);
error_helpfile varchar2(255);
error_helpID binary_integer;
begin
filename:='c:\reports\2007\overnight\meadowlandsflow';
i:=ORDExcel.CreateExcelWorkSheet('');
i:=ORDExcel.InsertData('A1', 'Day', 'BSTR');
i:=ORDExcel.InsertData('B1', 'Flow', 'BSTR');
For c1_rec IN c1 LOOP
cellColumn:=TO_CHAR(n);
cellIndex:=CONCAT('A',cellColumn);
dateValue:=c1_rec.time;
i:=ORDExcel.InsertData(cellIndex, dateValue, 'DATE');
cellIndex:=CONCAT('B',cellColumn);
cellValue:=c1_rec.flow;
i:=ORDExcel.InsertData(cellIndex, cellValue, 'BSTR');
n:=n+1;
END LOOP;
i:=ORDExcel.InsertChart(100,10,400,400,'Sheet2!$B$2:$B$365,Sheet2!$A$2:$A$365','xlLine');
select TO_CHAR(SYSDATE, 'DD-MON-YYYY') into returnedTime from dual;
filename:=CONCAT(filename, returnedTime);
i:=ORDExcel.SaveExcelFile(filename);
i:=ORDExcel.ExitExcel();
end;
</pre>
Any help is much appreciated.
Cheers
BradHi Saubhik ,
i saw that thread, but my question was that is there any limitation that the in order to use Oracle COM Automation should the OS on which oracle database is installed has to be Windows only.
or can it be implement in oracle database installed in Linux OS also ?
Edited by: krishna_36 on May 9, 2011 4:38 AM -
Open an Excel file to read and load it into Oracle - Oracle COM Automation
Hello All,
Please I need your help for this problem:
I need to load Excel sheet data (read the data) and load it into Oracle database (insert into a table), the excel file created and has data before, and saved with xls format. and I need to do that using the Oracle® COM Automation (ordcom package). The examples I found open and create a new workbook and deletes the old saved data, so I need to open (edit) the sheet just for reading.
I appreciate ans sample code to help me do that, Please help me out. This is very urgent.
Thanks alot and best regards,
NabilFor reading from Excel, there are some easy ways like Oracle Heterogenious Services. If you want to use COM then:
My orawpcom.dll file exists in the directory C:\oracle\product\10.2.0\db_2\bin
C:\oracle\product\10.2.0\db_2\bin>dir orawpco*.dll
Volume in drive C is C_Drive
Volume Serial Number is 8A93-1441
Directory of C:\oracle\product\10.2.0\db_2\bin
03/20/2006 05:06 PM 61,440 orawpcom.dll
10/11/2006 03:20 PM 81,920 orawpcom10.dll
2 File(s) 143,360 bytes
0 Dir(s) 65,407,717,376 bytes free
C:\oracle\product\10.2.0\db_2\bin>Information about my database version.
SQL> /* My databaser version */
SQL> SELECT * FROM v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL> Preparing the user SCOTT for COM automation.
Now, I will run comwrap.sql from scott user. I have edited the comwrap.sql to adjust my library path here:
create library utils_lib as 'C:\oracle\product\10.2.0\db_3\bin\orawpcom.dll';Running comwrap.sql and ExcelSolution.sql .....
SQL> conn scott@orclsb
Enter password: *****
Connected.
SQL> @c:\comwrap.sql
drop library utils_lib
ERROR at line 1:
ORA-04043: object UTILS_LIB does not exist
Library created.
drop package ORDCOM
ERROR at line 1:
ORA-04043: object ORDCOM does not exist
drop TYPE OAArgTable
ERROR at line 1:
ORA-04043: object OAARGTABLE does not exist
Type created.
drop TYPE OAArgTypeTable
ERROR at line 1:
ORA-04043: object OAARGTYPETABLE does not exist
Type created.
drop function OAgetNumber
ERROR at line 1:
ORA-04043: object OAGETNUMBER does not exist
Function created.
drop function OAgetStr
ERROR at line 1:
ORA-04043: object OAGETSTR does not exist
Function created.
drop function OAgetBool
ERROR at line 1:
ORA-04043: object OAGETBOOL does not exist
Function created.
drop function OAsetNumber
ERROR at line 1:
ORA-04043: object OASETNUMBER does not exist
Function created.
drop function OAsetString
ERROR at line 1:
ORA-04043: object OASETSTRING does not exist
Function created.
drop function OAsetBoolean
ERROR at line 1:
ORA-04043: object OASETBOOLEAN does not exist
Function created.
drop function OAInvokeDouble
ERROR at line 1:
ORA-04043: object OAINVOKEDOUBLE does not exist
Function created.
drop function OAInvokeBoolean
ERROR at line 1:
ORA-04043: object OAINVOKEBOOLEAN does not exist
Function created.
drop function OAInvokeString
ERROR at line 1:
ORA-04043: object OAINVOKESTRING does not exist
Function created.
drop function OACreate
ERROR at line 1:
ORA-04043: object OACREATE does not exist
Function created.
drop function OADestroy
ERROR at line 1:
ORA-04043: object OADESTROY does not exist
Function created.
drop function OAGetLastError
ERROR at line 1:
ORA-04043: object OAGETLASTERROR does not exist
Function created.
drop function OAQueryMethods
ERROR at line 1:
ORA-04043: object OAQUERYMETHODS does not exist
Function created.
Package created.
Package body created.
SQL>
SQL> @c:\ExcelSolution.sql
drop package ORDExcel
ERROR at line 1:
ORA-04043: object ORDEXCEL does not exist
Package created.
Package body created.
SQL>
I have modified ORDExcel a little bit and renamed it as ORDExcelSB. You need this version for reading the excel.
SQL> @C:\ExcelSolutionSB.sql
Package dropped.
Package created.
Package body created.
SQL> The actual code of ORDExcelSB (ExcelSolutionSB.sql) Is:
set serveroutput on;
drop package ORDExcelSB;
CREATE PACKAGE ORDExcelSB AS
/* Declare externally callable subprograms. */
FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer;
FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2) RETURN binary_integer;
FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer;
FUNCTION InsertData(range varchar2, data binary_integer, type varchar2) return binary_integer;
FUNCTION InsertDataReal(range varchar2, data double precision, type varchar2) return binary_integer;
FUNCTION GetDataNum(range varchar2) return binary_integer;
FUNCTION GetDataStr(range varchar2) return varchar2;
FUNCTION GetDataReal(range varchar2) return double precision;
FUNCTION GetDataDate(range varchar2) return date;
FUNCTION InsertData(range varchar2, data varchar2, type varchar2) return binary_integer;
FUNCTION InsertData(range varchar2, data Date, type varchar2) return binary_integer;
FUNCTION InsertChart(xpos binary_integer, ypos binary_integer, width binary_integer,
height binary_integer, range varchar2, type varchar2) return binary_integer;
FUNCTION SaveExcelFile(filename varchar2) return binary_integer;
FUNCTION ExitExcel return binary_integer;
END ORDExcelSB;
CREATE PACKAGE BODY ORDExcelSB AS
DummyToken binary_integer;
applicationToken binary_integer:=-1;
WorkBooksToken binary_integer:=-1;
WorkBookToken binary_integer:=-1;
WorkSheetToken binary_integer:=-1;
WorkSheetToken1 binary_integer:=-1;
RangeToken binary_integer:=-1;
ChartObjectToken binary_integer:=-1;
ChartObject1 binary_integer:=-1;
Chart1Token binary_integer:=-1;
i binary_integer;
retNum binary_integer;
retReal double precision;
retStr varchar2(255);
retDate DATE;
error_src varchar2(255);
error_description varchar2(255);
error_helpfile varchar2(255);
error_helpID binary_integer;
FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer IS
BEGIN
dbms_output.put_line('Creating Excel application...');
i := OrdCOM.CreateObject('Excel.Application',
0,
servername,
applicationToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking Workbooks...');
i := ORDCOM.GetProperty(applicationToken,
'WorkBooks',
0,
WorkBooksToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
RETURN i;
END CreateExcelApplication;
FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2)
RETURN binary_integer IS
BEGIN
dbms_output.put_line('Opening Excel file ' || filename || ' ...');
ORDCOM.InitArg();
ORDCOM.SetArg(filename, 'BSTR');
i := ORDCOM.Invoke(WorkBooksToken, 'Open', 1, DummyToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Opening WorkBook');
i := ORDCOM.GetProperty(applicationToken,
'ActiveWorkbook',
0,
WorkBookToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking WorkSheets..');
i := ORDCOM.GetProperty(applicationToken,
'WorkSheets',
0,
WorkSheetToken1);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking WorkSheet');
ORDCOM.InitArg();
ORDCOM.SetArg(sheetname, 'BSTR');
i := ORDCOM.GetProperty(WorkBookToken, 'Sheets', 1, WorkSheetToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Opened ');
RETURN i;
END OpenExcelFile;
* Invoke the Excel Automation Server and create a Workbook object as
* well as a worksheet object
FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer IS
BEGIN
dbms_output.put_line('Creating Excel application...');
i:=ORDCOM.CreateObject('Excel.Application', 0, servername,applicationToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking Workbooks...');
/*i:=ORDCOM.Invoke(applicationToken, 'WorkBooks',0, WorkBooksToken);*/
i:=ORDCOM.GetProperty(applicationToken, 'WorkBooks', 0, WorkBooksToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking Add to WorkBooks...');
ORDCOM.InitArg();
ORDCOM.SetArg(-4167,'I4');
i:=ORDCOM.Invoke(WorkBooksToken, 'Add', 1, WorkBookToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking WorkSheets..');
ORDCOM.InitArg();
ORDCOM.SetArg('Sheet 1','BSTR');
/* i:=ORDCOM.Invoke(applicationToken, 'WorkSheets', 1, WorkSheetToken);*/
i:=ORDCOM.GetProperty(applicationToken, 'WorkSheets', 0, WorkSheetToken1);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.Invoke(WorkSheetToken1, 'Add', 0, WorkSheetToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
return i;
END CreateExcelWorkSheet;
* Invoke the Range method to obtain a range token. Then set the property value
* at the specified range to the data required
FUNCTION InsertData( range varchar2,
data binary_integer,
type varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
IF (i=0) THEN
i:=ORDCOM.SetProperty(RangeToken, 'ColumnWidth', 15, 'I2');
END IF;
i:=ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertData;
* Invoke the Range method to obtain a range token. Then set the property value
* at the specified range to the data required
FUNCTION GetDataNum( range varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retNum);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.DestroyObject(RangeToken);
RETURN retNum;
END GetDataNum;
FUNCTION GetDataReal( range varchar2)
RETURN double precision IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retReal);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.DestroyObject(RangeToken);
RETURN retReal;
END GetDataReal;
FUNCTION GetDataStr( range varchar2)
RETURN varchar2 IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retStr);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.DestroyObject(RangeToken);
RETURN retStr;
END GetDataStr;
FUNCTION GetDataDate( range varchar2)
RETURN Date IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retDate);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.DestroyObject(RangeToken);
RETURN retDate;
END GetDataDate;
FUNCTION InsertData( range varchar2,
data DATE,
type varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
i:=ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertData;
FUNCTION InsertDataReal( range varchar2,
data double precision,
type varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
i:=ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertDataReal;
FUNCTION InsertData( range varchar2,
data varchar2,
type varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
i:=ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertData;
* Insert a chart at the x and y position of the spreadsheet with the desired
* height and width. Then also uses the ChartWizard to draw the graph with data
* in a specified range area with a specified charting type.
FUNCTION InsertChart(xpos binary_integer, ypos binary_integer,
width binary_integer, height binary_integer,
range varchar2, type varchar2) RETURN binary_integer IS
charttype binary_integer:= -4099;
BEGIN
ORDCOM.InitArg();
i:=ORDCOM.GetProperty(WorkSheetToken, 'ChartObjects', 0, ChartObjectToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
ORDCOM.InitArg();
ORDCOM.SetArg(xpos,'I2');
ORDCOM.SetArg(ypos,'I2');
ORDCOM.SetArg(width,'I2');
ORDCOM.SetArg(height,'I2');
i:=ORDCOM.Invoke(ChartObjectToken, 'Add', 4, ChartObject1);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.GetProperty(ChartObject1, 'Chart', 0,Chart1Token);
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i:=ORDCOM.GetProperty(WorkSheetToken,'Range', 1, RangeToken);
ORDCOM.InitArg();
ORDCOM.SetArg(RangeToken, 'DISPATCH');
IF type='xlPie' THEN
charttype := -4102;
ELSIF type='xl3DBar' THEN
charttype := -4099;
ELSIF type='xlBar' THEN
charttype := 2;
ELSIF type='xl3dLine' THEN
charttype:= -4101;
END IF;
ORDCOM.SetArg(charttype,'I4');
i:=ORDCOM.Invoke(Chart1Token,'ChartWizard', 2, DummyToken);
i:=ORDCOM.DestroyObject(RangeToken);
i:=ORDCOM.DestroyObject(ChartObjectToken);
i:=ORDCOM.DestroyObject(ChartObject1);
i:=ORDCOM.DestroyObject(Chart1Token);
RETURN i;
END InsertChart;
* Save the Excel File. WARNING: Do not specify a filename that already exist
* since there is no graphical context, Oracle would not be able to pop
* out a warning message for existing file. This causes Excel to hang
FUNCTION SaveExcelFile(filename varchar2) return binary_integer IS
BEGIN
dbms_output.put_line('Saving Excel file...');
ORDCOM.InitArg();
ORDCOM.SetArg(filename,'BSTR');
i:=ORDCOM.Invoke(WorkBookToken, 'SaveAs', 1, DummyToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
RETURN i;
END SaveExcelFile;
* Close the Excel spreadsheet and exit from it
FUNCTION ExitExcel return binary_integer is
BEGIN
dbms_output.put_line('Closing workbook and quitting...');
ORDCOM.InitArg();
ORDCOM.InitArg();
ORDCOM.SetArg(FALSE,'BOOL');
dbms_output.put_line('Closing workbook...');
i:=ORDCOM.Invoke(WorkBookToken, 'Close', 0, DummyToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.DestroyObject(WorkBookToken);
ORDCOM.InitArg();
dbms_output.put_line('Closing workbooks...');
i:=ORDCOM.Invoke(WorkBooksToken, 'Close', 0, DummyToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.DestroyObject(WorkBooksToken);
i:=ORDCOM.Invoke(applicationToken, 'Quit', 0, DummyToken);
IF (i!=0) THEN
ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i:=ORDCOM.DestroyObject(WorkSheetToken);
i:=ORDCOM.DestroyObject(WorkSheetToken1);
i:=ORDCOM.DestroyObject(applicationToken);
i:=ORDCOM.DestroyObject(ChartObjectToken);
i:=ORDCOM.DestroyObject(Chart1Token);
i:=ORDCOM.DestroyObject(ChartObject1);
i:=ORDCOM.DestroyObject(dummyToken);
RETURN i;
END ExitExcel;
END ORDExcelSB;
/I have created an excel named as C:\Example.xls.
Name SlNo Job Dept Salary Bonus
Saubhik Banerjee 706090 IT Specialist GBS 100 10
Partha S Mohanty 706091 Pogrmmer APPS 70 20
Partha Sarkar 889300 Condultant FIN 200 30
Useless 98009 PM PM 900 90
SQL> SET SERVEROUT ON
SQL> DECLARE
2
3 v_Name varchar2(90);
4 v_SlNo varchar2(100);
5 v_Job varchar2(200);
6 v_Dept varchar2(100);
7 v_recon_remark varchar2(50);
8 v_sal_amt_usd number;
9 v_Bonus_amt_usd number;
10
11 result INTEGER;
12
13 i binary_integer;
14 filename varchar2(255);
15
16 BEGIN
17
18 filename := 'C:\Example.xls';
19
20 result := ORDExcelSB.CreateExcelApplication('');
21 result := ORDExcelSB.OpenExcelFile(filename, 'Sheet1');
22
23 /* Excluding the header row and reading the first 5 row */
24 FOR n in 2 .. 5 LOOP
25
26 v_Name := ORDExcelSB.GetDataStr('A' || n);
27 v_SlNo := ORDExcelSB.GetDataReal('B' || n);
28 v_Job := ORDExcelSB.GetDataStr('C' || n);
29 v_Dept := ORDExcelSB.GetDataStr('D' || n);
30 v_sal_amt_usd := ORDExcelSB.GetDataNum('E' || n);
31 v_Bonus_amt_usd := ORDExcelSB.GetDataNum('F' || n);
32
33 dbms_output.put_line(v_Name || ' ' || v_SlNo || ' ' || v_Job || ' ' ||
34 v_Dept || ' ' || v_sal_amt_usd || ' ' ||
35 v_Bonus_amt_usd);
36
37 END LOOP;
38
39 result := ORDExcelSB.ExitExcel();
40 EXCEPTION
41 WHEN OTHERS THEN
42 result := ORDExcelSB.ExitExcel();
43 RAISE;
44 END;
45 /
Creating Excel application...
Invoking Workbooks...
Opening Excel file C:\Example.xls ...
Opening WorkBook
Invoking WorkSheets..
Invoking WorkSheet
Opened
Saubhik Banerjee 706090 IT Specialist GBS 100 10
Partha S Mohanty 706091 Pogrmmer APPS 70 20
Partha Sarkar 889300 Condultant FIN 200 30
Useless 98009 PM PM 900 90
Closing workbook and quitting...
Closing workbook...
Closing workbooks...
PL/SQL procedure successfully completed.
SQL> Although, You haven't asked, but you can use this code to write to excel file (.xls)
DECLARE
CURSOR c1 IS
SELECT empno, ename, dname, sal, hiredate
FROM emp e, dept d
WHERE e.deptno = d.deptno;
error_message varchar2(1200);
n binary_integer:=2;
i binary_integer;
filename varchar2(255);
cellIndex varchar2(40);
cellValue varchar2(40);
cellColumn varchar2(10);
returnedTime varchar2(20);
currencyvalue double precision;
datevalue DATE;
empno binary_integer;
looptext varchar2(20);
error_src varchar2(255);
error_description varchar2(255);
error_helpfile varchar2(255);
error_helpID binary_integer;
begin
filename:='c:\example2.xls';
i:=ORDExcel.CreateExcelWorkSheet('');
i:=ORDExcel.InsertData('A1', 'EmpNo', 'BSTR');
i:=ORDExcel.InsertData('B1', 'Name', 'BSTR');
i:=ORDExcel.InsertData('C1', 'Dept', 'BSTR');
i:=ORDExcel.InsertData('D1', 'Salary', 'BSTR');
i:=ORDExcel.InsertData('E1', 'HireDate', 'BSTR');
For c1_rec IN c1 LOOP
cellColumn:=TO_CHAR(n);
cellIndex:=CONCAT('A',cellColumn);
cellValue:=TO_CHAR(c1_rec.empno);
empno:=cellValue;
i:=ORDExcel.InsertData(cellIndex, empno, 'I2');
cellIndex:=CONCAT('B',cellColumn);
cellValue:=c1_rec.ename;
i:=ORDExcel.InsertData(cellIndex, cellValue, 'BSTR');
cellIndex:=CONCAT('C',cellColumn);
cellValue:=c1_rec.dname;
i:=ORDExcel.InsertData(cellIndex, cellValue, 'BSTR');
cellIndex:=CONCAT('D',cellColumn);
cellValue:=c1_rec.sal;
currencyValue:=cellValue;
i:=ORDExcel.InsertData(cellIndex, currencyValue, 'CY');
cellIndex:=CONCAT('E',cellColumn);
dateValue:=c1_rec.hiredate;
i:=ORDExcel.InsertData(cellIndex, dateValue, 'DATE');
n:=n+1;
END LOOP;
i:=ORDExcel.SaveExcelFile(filename);
i:=ORDExcel.ExitExcel();
EXCEPTION
WHEN OTHERS THEN
i:=ORDExcel.ExitExcel();
RAISE;
END; -
Error -2147024894 when trying to use ActiveX Automation Open
Hello,
I use the Automation Open on an ActiveX Class (which is creatable when I choose it from the list). When I do this I get the error:
Error -2147024894 occurred at The system cannot find the file specified.
Does anyone know what this error means?
Thanks a lot,
LaurentHi Laurent,
This is usally caused by registration problems of your activeX server with Windows. This is usally done while you install a ActiveX capable application but it could fail. for more information see the attached Knowledge base. This deals with LabWindows/CVI and MS Excel but this is more a general issue.
http://digital.ni.com/public.nsf/websearch/7139D4FDE76185EE86257195007118EC?OpenDocument
Hope this helps
Thanks
Karsten -
COM Automation: getProperty problems
Hi,
I know that the topic of this post don't belongs to this subcategory, but really I cannot find where to put it.
I'm implementing a solucion using Oracle COM Automation to use a DLL through its COM interface from PL/SQL. The connection is done ok, and I can instantiate the object, get properties, set properties, invoke methods, etc.
The problem is that when I use getProperty to get a Property that's empty (null), it returns the last value for which getProperty obtained a valid value:
COM Object
- Property A. Value: 'dog'
- Property B. Value: 'cat'
- Property C. Value: '' (empty)
Pseudocode:
1- CreateObject using COM interface --> OK
2- getProperty('A') --> dog
3- getProperty('B') --> cat
4- getProperty('C') --> cat
So, as you can see, getProperty('C') returns the last value obtained in a getProperty that returned a value (getProperty('B)). Any of you has any clue on what could be wrong with the Oracle COM Automation method to access a COM interface?
Thanks a lot in advance,
Luis MiguelSorry, I meant to say 12g is where it wont be included.
The migration path is .NET stored procedures. You should also be able to call a COM object via via COM Interop, but you'd be breaking new ground there in a sense as I'm not sure that that is something Oracle has tested, and I haven't heard from other customers that are doing that, so if there are issues there you maybe the one to uncover them.
Greg -
I develop an application that does some PowerPoint automation using embedded interop types (C# App - with VB assembly that does the office automation part)
I've started to get reports that the PowerPoint automation is failing on Office 365.
Here is a sample of a typical customer complaint:
not exporting to powerpoint...
We recently migrated from Office2007 to O365. That would be definitely the reason.
But how can we solve this?
I found the following reply to a forum question:
https://social.msdn.microsoft.com/Forums/office/en-US/3c95eea4-641f-4bf0-a166-ecf33177854b/does-desktop-versions-of-applications-in-office-365-packages-support-comautomation?forum=exceldev
But it only states that one version doesn't - and then one version does - doesn't reference a list of all support versions.
Also - later - in that thread - it is shown that the accepted answer is actually incorrect.
A sample of the type of code used to interact is shown here....
Public Function PositionSlideTitle(ByVal slide As PowerPoint.Slide, ByVal height As Single, ByVal marginX As Single, ByVal marginY As Single) As PowerPoint.Shape
Dim shapes As PowerPoint.Shapes
Dim shape As PowerPoint.Shape
' get the shapes on the slide
shapes = slide.Shapes
' get the shape that holds the title
' if the shapes collection has a title, then this title shape is always in index 1
If shapes.HasTitle = Office.MsoTriState.msoTrue Then
' the title shape can also be accessed by the special property Title
shape = shapes.Title
Else
' If there was no title - then add one
shape = shapes.AddTitle()
End If
' position the shape at 0,0 (seems not to want to go there)
shape.Left = marginX
shape.Top = marginY
' stretch image to fit slide
shape.Width = slide.Master.Width - (marginX * 2)
shape.Height = height
Return shape
End Function
The project references Microsoft.Office.Interop.PowerPoint, version 11.0.0.0 with it's "Embed Interop Types" set to true.
This has worked for 10+ years, with all versions of office from Office 2003. We still need the application to support Office 2003 - and it still does perfectly, so referencing newer PIA's isn't an option.
Please help.Great to know that all versions of Office Support Com Automation.
Because the end-users that have made the complaint - are using Office 365 - it wouldn't be the Click2Run edition as you've mentioned - but it's good to know that information, as I wasn't aware there was a possible issue with that - thanks.
I'll just assume then that the end user that sent the following issue is running them with different permission level:
not exporting to powerpoint...
We recently migrated from Office2007 to O365. That would be definitely the reason.
But how can we solve this?
Although - one more thought - I read somewhere that O365 users can install office via the O365 portal - I wonder whether this is the same as Click2Run install - and hence causing the same out-of-process application error you have referred to?
Kind Regards
UPDATE:
Further reading/searching on click-to-run and O365 found the following:
I can't paste links in this forum, but:
technet microsoft com "en-us/library/jj219427.aspx"
Eugene - you may be onto something with the click-to-run issue - that may be the cause of the error in O365 installations - At least now I have a scenario to test against (user info is always difficult to determine exactly how to replicate issues) - Cheers. -
I am interested in learning what support Oracle
Forms 10g has for com automation. Where can I go for more informationI guess you might want to use PJC with JIntegra for COM
Maybe you are looking for
-
Problem in setting the parameters for an OASingleSelectionBean
Hi, I have created an advanced table, for which I have to allow single selection or mutliple selection according to my requirements ie dynamically. So, for single selection, I have created a OASingleSelectionBean dynamically and add this to my advanc
-
Is the iPod nano [second generation] supported by OS Lion and iTunes 10
Hi All I cannot "see" my 2nd gen iPod nano on iTunes 10.6 running on a new iMac with OS Lion. I have worked through the various troubleshooters to no avail. Have Apple ceased to support the 2nd gen nano? LF
-
Problem when using Javabeans in ADF?
Hi, I encountered a problem when using ADF. Please look at the following 2 classes : public class Person private String name; private String city; private int age; public Person(String name, int age, String city) this.name = name; this.age = age; thi
-
Hi, Im trying to get my java program to connect to MSSQL but the drivers dont want to work. Basically what I did is installed the drivers from MS, and also tried to set Classpath to C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\ But
-
Delete Lock Screen Wallpaper/ Using Customize To Change Slider Icons
So, though it may sound a bit silly, i've had different wallpapers display on my lock screen for some time now, but i've found that i have absolutley no idea how to take it off. i'd simply like to revert back the the battery image on the lock screen,