|
Re: How to SetSourceData into excel.chart in form6i [message #309634 is a reply to message #309620] |
Fri, 28 March 2008 04:17 |
tony2008
Messages: 4 Registered: March 2008
|
Junior Member |
|
|
I can use ole2 to create excel chart in form6I,when I want to SetSourceData into excel.chart,the is no result from the program.
DECLARE
w_excelapp OLE2.OBJ_TYPE;
w_workbooks OLE2.OBJ_TYPE;
w_workbook OLE2.OBJ_TYPE;
w_worksheet OLE2.OBJ_TYPE;
w_workcharts OLE2.OBJ_TYPE;
w_workchart OLE2.OBJ_TYPE;
w_arg OLE2.LIST_TYPE;
w_arg_list OLE2.LIST_TYPE;
BEGIN
w_excelapp := OLE2.CREATE_OBJ('EXCEL.APPLICATION');
OLE2.SET_PROPERTY(w_excelapp, 'DISPLAYALERTS', 'FALSE');
w_workbooks:= OLE2.GET_OBJ_PROPERTY(w_excelapp, 'WORKBOOKS');
w_workbook := OLE2.GET_OBJ_PROPERTY(w_workbooks, 'ADD');
w_arg := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(w_arg, 1);
w_worksheet:=OLE2.GET_OBJ_PROPERTY(w_workbook, 'WORKSHEETS', w_arg);
OLE2.DESTROY_ARGLIST(w_arg);
w_workcharts:=OLE2.GET_OBJ_PROPERTY(w_workbook,'CHARTS');
w_workchart := ole2.Invoke_obj(w_workcharts, 'Add');
OLE2.SET_PROPERTY(w_workchart, 'NAME', 'CBA');
-----------------------------------------------------------------
--the is no result in this part
w_arg_list := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(w_arg_list, 'Sheets("Sheet1").Range("A1:E7")');
OLE2.ADD_ARG(w_arg_list, 'xlColumns');
OLE2.INVOKE(w_workchart, 'SetSourceData', w_arg_list);
OLE2.DESTROY_ARGLIST(w_arg_list);
-----------------------------------------------------------------
w_arg := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(w_arg, 'C:\1.XLS');
OLE2.INVOKE(w_workbook, 'SAVEAS', w_arg);
OLE2.DESTROY_ARGLIST(w_arg);
IF w_worksheet IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_worksheet);
END IF;
IF w_workchart IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_workchart);
END IF;
IF w_workcharts IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_workcharts);
END IF;
IF w_workbook IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_workbook);
END IF;
IF w_workbooks IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_workbooks);
END IF;
IF w_excelapp IS NOT NULL THEN
OLE2.INVOKE(w_excelapp, 'QUIT');
OLE2.RELEASE_OBJ(w_excelapp);
END IF;
END;
|
|
|
|
|
|
Re: How to SetSourceData into excel.chart in form6i [message #313267 is a reply to message #310015] |
Fri, 11 April 2008 05:03 |
czhtony2008
Messages: 13 Registered: April 2008
|
Junior Member |
|
|
this question is solved
PROCEDURE p_add_workchart(form_workbook IN OUT OLE2.OBJ_TYPE,
form_workchart IN OUT OLE2.OBJ_TYPE,
form_chartname VARCHAR2,
form_charttype NUMBER,
form_chartsource VARCHAR2) IS
w_workcharts OLE2.OBJ_TYPE;
w_seriescollection OLE2.OBJ_TYPE;
w_series OLE2.OBJ_TYPE;
w_args OLE2.LIST_TYPE;
w_Legend OLE2.OBJ_TYPE;
BEGIN
w_workcharts := OLE2.GET_OBJ_PROPERTY(form_workbook, 'CHARTS');
--FIRST RELEASE THE OBJECT
IF form_workchart IS NOT NULL THEN
OLE2.RELEASE_OBJ(form_workchart);
END IF;
form_workchart := ole2.Invoke_obj(w_workcharts, 'Add');
OLE2.SET_PROPERTY(form_workchart, 'NAME', form_chartname);
OLE2.SET_PROPERTY(form_workchart, 'ChartType', form_charttype);
w_seriescollection := OLE2.INVOKE_OBJ(form_workchart, 'SeriesCollection');
w_args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(w_args, form_chartsource);
OLE2.ADD_ARG(w_args, 2 );
OLE2.ADD_ARG(w_args, 0 );
OLE2.ADD_ARG(w_args, 1 );
OLE2.ADD_ARG(w_args, 0 );
OLE2.INVOKE(w_seriescollection,'Add', w_args);
OLE2.DESTROY_ARGLIST(w_args);
OLE2.SET_PROPERTY(form_workchart, 'HasLegend', 1);
w_Legend := OLE2.GET_OBJ_PROPERTY(form_workchart, 'Legend');
OLE2.SET_PROPERTY(w_Legend, 'Position', -4107);
IF w_Legend IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_Legend);
END IF;
IF w_series IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_series);
END IF;
IF w_seriescollection IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_seriescollection);
END IF;
IF w_workcharts IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_workcharts);
END IF;
EXCEPTION WHEN OLE2.OLE_ERROR THEN
p_show_ole_err;
IF w_series IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_series);
END IF;
IF w_seriescollection IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_seriescollection);
END IF;
IF w_workcharts IS NOT NULL THEN
OLE2.RELEASE_OBJ(w_workcharts);
END IF;
END;
|
|
|
|