首页 > 代码库 > Formatting Excel File Using Ole2 In Oracle Forms
Formatting Excel File Using Ole2 In Oracle Forms
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
-- 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
Formatting Excel File Using Ole2 In Oracle Forms
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。