PhpExcel - How insert the same row after row N?

前端 未结 1 1064
孤城傲影
孤城傲影 2021-02-19 23:29

I have php template. this is a empty table (T0 rows) with some footer at the bottom. From php i try to fill the table, but if i had T1 rows (T1 > T0) then trouble appers.

<
相关标签:
1条回答
  • 2021-02-19 23:49

    Just copying what @markBaker said (so that we can set the solution as an answer):

    //Insert 10 new rows between rows 1 and 2 
    $objPHPExcel->getActiveSheet()->insertNewRowBefore(2,10); 
    

    Now applying the style of the row 2 to the inserted rows:

    $objPHPExcel->getActiveSheet()->duplicateStyle($objPHPExcel->getActiveSheet()->getStyle('A1'),'A2:A10'); 
    
    0 讨论(0)
提交回复
热议问题