首页 > 其他分享 >OLE Excel 按行列号赋值 demo

OLE Excel 按行列号赋值 demo

时间:2022-09-30 23:36:05浏览次数:53  
标签:SET OLE demo Excel FRM CELL EXCEL ROW

货铺QQ群号:834508274

下面开始干货:


上篇OLE中Excel单元格赋值,使用的是

PERFORM fill_range 填充行

PERFORM insert_row 添加新行


其中

FORM fill_range USING value(f_range)

                      value(f_value).

  CALL METHOD OF

      wsheetobj

      'Range'   = rangeobj

    EXPORTING

      #1        = f_range.

  SET PROPERTY OF rangeobj 'Value' = f_value.

ENDFORM.                    "fill_range



很多时候是直接用的Excel 行列直接进行赋值。


具体demo不做了,这里只写几个用到的form

*&---------------------------------------------------------------------*
* 打开EXCEL
*----------------------------------------------------------------------*
* -->P_L_FILE text
*----------------------------------------------------------------------*
Form FRM_EXCEL_OPEN Using P_L_FILE.

Create OBJECT EXCEL 'EXCEL.APPLICATION'.
If SY-SUBRC <> 0.
Message 'Excel开打失败!.' Type 'S'.
Stop.
Else.
Set Property Of EXCEL 'VISIBLE' = 1.
Call Method Of EXCEL 'WORKBOOKS' = WORKBOOK. "新产生一个Excel
Call Method Of WORKBOOK 'OPEN'
Exporting
#1 = P_L_FILE. "要打开的Excel的路径
Get Property Of EXCEL 'ACTIVECELL' = SHEET.
Endif.
Call Method Of EXCEL 'WORKSHEETS' = SHEET
Exporting
#1 = 'SHEET1'.
Call Method Of SHEET 'ACTIVATE'.

Endform. " FRM_EXCEL_OPEN


*&---------------------------------------------------------------------*
*& Form FRM_CELL_SET
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ROW 第几行
* -->P_COL 第几列
* -->P_D_BUTXT 要填的值
*----------------------------------------------------------------------*
Form FRM_CELL_SET Using P_ROW
P_COL
P_D_BUTXT.
Call Method Of SHEET 'CELLS' = CELL
Exporting
#1 = P_ROW
#2 = P_COL.
Set Property Of CELL 'VALUE' = P_D_BUTXT.

Endform. " FRM_CELL_SET


Loop At lT_data into ls_data.
Perform FRM_CELL_SET Using L_ROW 1 ls_data-C01.
Perform FRM_CELL_SET Using L_ROW 2 ls_data-c02.

L_ROW = L_ROW + 1.
Endloop.

标签:SET,OLE,demo,Excel,FRM,CELL,EXCEL,ROW
From: https://blog.51cto.com/u_15680210/5727550

相关文章

  • Demo:代码完成Excel数据并发送Email附件
    货铺QQ群号:834508274有时候没有上载操作,直接组织数据并生成Excel附件直接发送。效果图参考代码REPORTzlm_email03.TYPE-POOLS:ixml.TYPES:BEGINOFxml_line,......
  • DEMO:关闭采购订单 BAPI_PO_CHANGE(带增强字段)
    货铺QQ群号:834508274调用BAPI的时候注意DEMOREPORTZDEMO_CLOSE_PO.PARAMETERSP_POTYPEBAPIMEPOHEADER-PO_NUMBER..DATA:LT_RETURNLIKETABLEOFBAPIRET2,LS_RETURN......
  • DEMO:PR 添加新行项目 BAPI_PR_CHANGE
    货铺QQ群号:834508274REPORTZLM_PR_CHANGE.PARAMETERS:P_BANFNTYPEVBEP-BANFNOBLIGATORY.DATA:LS_PRHEADERLIKEBAPIMEREQHEADER,"LS_PRHEADERXLIKEBAPIMEREQ......
  • DEMO: ME51N 创建PR BAPI_REQUISITION_CREATE
    货铺QQ群号:834508274*&---------------------------------------------------------------------**&BAPI_REQUISITION_CREATE和BAPI_PR_CREATE相关问题查看NOTE*&49962......
  • DEMO: ME51N 创建PR BAPI_PR_CREATE
    货铺QQ群号:834508274*&---------------------------------------------------------------------**&BAPI_REQUISITION_CREATE和BAPI_PR_CREATE相关问题查看NOTE*&49962......
  • DEMO:修改外向交货单BAPI_OUTB_DELIVERY_CHANGE
    货铺QQ群号:834508274TABLES:LIKP,LIPS.PARAMETERS:P_VBELNTYPEVBELN_VL.PARAMETERS:P_SERNRTYPEOBJK-SERNR.DATA:LS_HEADER_DATALIKEBAPIOBDLVHDRCHG,LS_HEADER_C......
  • Demo:替代
    货铺QQ群号:834508274下面开始干货:Tcode:OBBH:新建步骤:选择替换字段:设置先决条件:这里demo输入常量:替换:维护出口代码:Tcode:Gcx2:代码由两部分构成:在form get_exit_titles先声明......
  • Demo:校验
    货铺QQ群号:834508274下面开始干货:tcode:GGB0设置先决条件设置检查点这里ZU01对应的代码是需要配置维护的。不然是显示不出来ZU01的。ZU01代码的相关配置维护点:Tcode:GCX2Co......
  • 启动文件系统时出现错误:Warning: unable to open an initial console.
    ————————————————————————————————(一)启动文件系统时出现错误:Warning:unabletoopenaninitialconsole.—————————————......
  • delphi TMS FlexCel 导出HTML设置
    TMSFlexCel导出HTML设置属性和方法TFlexCelHtmlExport.HtmlVersionpropertyHtmlVersion:THtmlVersion生成的HTML版本。THtmlVersion定义导出时将使用的HTML......