OLE2 for formating Excel Sheet [message #345328] |
Wed, 03 September 2008 01:45  |
prachi.mgorwadkar
Messages: 75 Registered: May 2007 Location: Pune
|
Member |
|
|
Hello All,
I have one form through I have created one Excel Sheet.
I want to format this sheet through my form, where I want to AutoFit particular columns i.e. "B:L".
But, form does not accept double quotes.
I have written a procedure as below:
PROCEDURE auto_fit IS
BEGIN
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'D:E');
range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange', args);
range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
OLE2.INVOKE( range_col,'AutoFit' );
OLE2.DESTROY_ARGLIST(args);
OLE2.RELEASE_OBJ( range );
OLE2.RELEASE_OBJ( range_col );
END;
And called this Procedure at the end, means after inserting all data in the excel file.
But, this Procedure does not work. It gives non-ORACLE error.
Can anybody give me any solution?
|
|
|
|
|
|
Re: OLE2 for formating Excel Sheet [message #345346 is a reply to message #345328] |
Wed, 03 September 2008 02:50   |
prachi.mgorwadkar
Messages: 75 Registered: May 2007 Location: Pune
|
Member |
|
|
Sir,
I have tried:
"B:E"
'"B:E"'
'B:E'
Nothing works.
One Procedure I found as :
PROCEDURE auto_fit(p_col IN NUMBER) IS
v_args ole2.list_type;
v_col ole2.obj_type;
BEGIN
v_args :=ole2.create_arglist;
ole2.add_arg(v_args, p_col);
v_col := ole2.get_obj_property(v_worksheet, 'Columns', v_args);
ole2.invoke(v_col, 'AutoFit');
ole2.destroy_arglist(v_args);
ole2.release_obj(v_col);
END auto_fit;
But this is only for single column, not for a range.
Thanks,
- Prachi
|
|
|
|
Re: OLE2 for formating Excel Sheet [message #345537 is a reply to message #345493] |
Thu, 04 September 2008 01:10   |
|
I am using this code and it works fine in 6i and also in 10g(WITH CLIENT_OLE2)
ExcelArgs := ole2.create_arglist;
OLE2.ADD_ARG(ExcelArgs, 'C:I');
column3 := OLE2.GET_OBJ_PROPERTY(ExcelWorkSheetID, 'Columns', ExcelArgs);
OLE2.DESTROY_ARGLIST(ExcelArgs);
OLE2.SET_PROPERTY(column3, 'ColumnWidth', 12);
OLE2.RELEASE_OBJ(column3);
|
|
|
|