代码语言:javascript复制
DATA lc_range TYPE ole2_object.
DATA lv_sheet TYPE ole2_object.
DO 2 TIMES.
CALL METHOD OF lv_sheet 'Rows' = lc_range
EXPORTING #1 = 7.
CALL METHOD OF lc_range 'Copy'. "COPY第6行插入一个新行
CALL METHOD OF lv_sheet 'Rows' = lc_range
EXPORTING #1 = 7 .
CALL METHOD OF lc_range 'Insert'.
CALL METHOD OF lc_range 'ClearContents'. "是否需要清空Cell
ENDDO .
CALL METHOD OF lv_sheet 'copy'
EXPORTING
#1 = lv_sheet.
SET PROPERTY OF lv_sheet 'name' = 'hhh'.
CALL METHOD OF lv_sheet 'ACTIVATE'.