我想在行号$ insert_here之后添加$ x行。
这是功能:
// Get the Excel file I want to work on:
function get_excel_file(){
// Need to define this to change a global variable inside a function
global $objPHPExcel;
// Define an Exel Object to read files from:
$objPHPExcel = PHPExcel_IOFactory::load('keywords.xlsx');
}
// Inserts new rows: Gets the number of rows to insers them before the second variable
function insert_rows( $objPHPExcel, $insert_here, $num_rows ){
echo $num_rows, $insert_here;
$objPHPExcel->getActiveSheet()->insertNewRowBefore( $insert_here, $num_rows );
}
调用函数时,我得到了很好的变量回声。所以我确定它不是来自变量。
可能是什么问题? Excel文件看起来完全相同,没有插入新行。