Below is the some useful commands of Ole2 to format excel file in Oracle Forms.
-- Change font size and name in ole2
-- Declare as cfont ole2.obj_type;
CFONT := OLE2.GET_OBJ_PROPERTY(CELL, 'Font');
OLE2.SET_PROPERTY(CFONT, 'Name','Calibri');
OLE2.SET_PROPERTY(CFONT, 'Bold',1);
OLE2.SET_PROPERTY(CFONT, 'Size',11);
ole2.release_obj(CFONT);
--
-- Changing number format with ole2
OLE2.SET_PROPERTY(cell, 'NumberFormat', '00,0,0,000.00');
--
-- Changing background color in ole2
-- Declare colour ole2.obj_type;
colour:=ole2.get_obj_property(cell, 'Interior');
ole2.set_property(colour, 'ColorIndex', 33);
-- Border color
colour:=ole2.get_obj_property(cell, 'Borders');
ole2.set_property(colour, 'ColorIndex', 1);
--
-- Wrapping text in ole2
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 2);
OLE2.ADD_ARG(args, 1);
cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
ole2.set_property(cell, 'WrapText', 'True');
OLE2.DESTROY_ARGLIST(args);
--
-- Autofit columns in ole2
range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
OLE2.INVOKE( range_col,'AutoFit' );
OLE2.RELEASE_OBJ( range );
OLE2.RELEASE_OBJ( range_col );
--
-- Saving a excel file in ole2
args := OLE2.Create_Arglist;
filen := 'c:myfile.xls';
OLE2.ADD_ARG(args,filen);
OLE2.INVOKE(workbook, 'SaveAs', args);
OLE2.DESTROY_ARGLIST(args);
--
See also: Create Excel File in Oracle Forms http://foxinfotech.blogspot.com/2013/02/creating-excel-file-in-oracle-d2k-forms.html