ABAP OLE相关的应用

excel文件,最常用的一些OLE 知识如下:
 
冻结列或行
 

  call method of excel_obj 'Range'= range_obj
    exporting #1= 'D4'.
  call method of range_obj 'Select' .
  call method of excel_obj 'ActiveWindow' =window_obj.
  set property of window_obj 'FreezePanes' =1.

 

此代码将excel从前三列和前三开始将窗体冻结

 

隐藏列

 

  callmethod of excel_obj 'Columns' = column_obj
    exporting #1= 'E:I' .
  call method of column_obj 'Select' .
  set property of column_obj 'Hidden' = 1.

 

增加批注

 

 call method of excel_obj 'Range'= range_obj
    exporting #1 = 'B5' .
  call method of range_obj 'Select' .
  call method of range_obj 'AddComment' exporting#1 = '系统注释:你可以查看zmb51'.

 

设置背景

 

  call method of sheet_obj 'Range' = range_objexporting #1 = 'B5' .
  call method of range_obj 'Interior' =Interior_obj.
  set property of Interior_obj 'ColorIndex' = 3.

 

合并单元格

 

form set_cell_union using i j val.

  CALL METHOD OF excel_obj 'Range' =range_obj
    EXPORTING #1= i #2 = j .

  SET PROPERTY OF range_obj 'MergeCells' =1.
  SET PROPERTY OF range_obj 'Value' = val .
endform.

 

运行宏

 

perform runmacro using 'deleteRows'.

 

FORM runmacro USING macroname.
  CALL METHOD OF excel_obj 'RUN'
     EXPORTING
         #1 = macroname.
ENDFORM.

 

设置边框(设置区域边框)

 

FORM set_cell_border2 using s e w.
  CALL METHOD OF excel_obj 'Range' =range_obj
   EXPORTING #1 = s
            #2 = e.

  GET PROPERTY OF range_obj 'Borders' =borders_obj .
  SET PROPERTY OF borders_obj 'LineStyle' = '1'.
SET PROPERTY OF borders_obj 'WEIGHT' =w.
  FREE OBJECT borders_obj.
ENDFORM.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值