Home » Developer & Programmer » Forms » OLE2 Excel Chart
OLE2 Excel Chart [message #77812] Mon, 26 November 2001 01:33 Go to next message
LorenzoIzzo
Messages: 1
Registered: November 2001
Junior Member
I use the Oracle Developer/2000 Form.
I transfer data to excel from Form using OLE2.
I am unable to create Excel chart using function "SetSourceData".
Could anyone give a solution for this problem.

----------------------------------------------------------------------
Re: OLE2 Excel Chart [message #77830 is a reply to message #77812] Thu, 29 November 2001 01:08 Go to previous messageGo to next message
Pandari Suresh Kumar
Messages: 5
Registered: October 2001
Junior Member
You Can try this:

It takes a 4-column multi-record Forms block, writes column headers to excel (the :subtotals_buttons.label1 logic), then loops through the block and writes the data from the Forms block to Excel. - Dave

DECLARE

application OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
arg1 NUMBER := 2;
arg2 NUMBER := 1;

BEGIN
set_cursor_busy;

--Start Excel, make it visible

application := OLE2.CREATE_OBJ('Excel.Application');
OLE2.SET_PROPERTY(application,'Visible','True');
OLE2.INVOKE(application,'AppShow');

workbooks := OLE2.GET_OBJ_PROPERTY(application,'Workbooks');

workbook := OLE2.GET_OBJ_PROPERTY(workbooks,'Add');

worksheets := OLE2.GET_OBJ_PROPERTY(workbook,'Worksheets');

worksheet := OLE2.GET_OBJ_PROPERTY(worksheets,'Add');

set_cell_char (worksheet,
1,
1,
:subtotals_buttons.label1);

set_cell_char (worksheet,
1,
2,
:subtotals_buttons.label2);

set_cell_char (worksheet,
1,
3,
:subtotals_buttons.label3);

set_cell_char (worksheet,
1,
4,
'Totals');

--Return object handle to cell A1 on the new Worksheet
go_block('subtotals');
first_record;

while :system.last_record <> 'TRUE' LOOP

set_cell_char(worksheet,
arg1,
1,
:SUBTOTALS.column1);

set_cell_char(worksheet,
arg1,
2,
:SUBTOTALS.column2);

set_cell_char(worksheet,
arg1,
3,
:SUBTOTALS.column3);

set_cell_char(worksheet,
arg1,
4,
:SUBTOTALS.column4);

arg1 := arg1 + 1;
next_record;

END LOOP;

-- export last detail row, not included in above loop
set_cell_char(worksheet,
arg1,
1,
:SUBTOTALS.column1);

set_cell_char(worksheet,
arg1,
2,
:SUBTOTALS.column2);

set_cell_char(worksheet,
arg1,
3,
:SUBTOTALS.column3);

set_cell_char(worksheet,
arg1,
4,
:SUBTOTALS.column4);

--RELEASE OLE OBJECTS
set_cursor_default;
OLE2.RELEASE_OBJ(cell);
OLE2.RELEASE_OBJ(worksheet);
OLE2.RELEASE_OBJ(worksheets);
OLE2.RELEASE_OBJ(workbook);
OLE2.RELEASE_OBJ(workbooks);
OLE2.RELEASE_OBJ(application);

synchronize;

message('Subtotals have been loaded in Excel.');
message(' ');
GO_ITEM('subtotals_buttons.b_close');

exception
when others then
message(' ');

end;

----------------------------------------------------------------------
Re: OLE2 Excel Chart [message #78901 is a reply to message #77830] Thu, 28 March 2002 05:05 Go to previous message
Benjamin
Messages: 4
Registered: March 2002
Junior Member
Hi Dave,

In your example you use the next procedures:

set_cursor_busy;
set_cell_char(......);

What do they do? These are yours? Where can I get them?

Thanks in advance,

Benjamin
Previous Topic: choosing master and detail
Next Topic: Closing Forms MDI window
Goto Forum:
  


Current Time: Fri Jun 05 14:07:43 CDT 2020