你好,我已经创建了microsoft excel文件,显示来自mysql的所有数据与foreach,问题是如何在循环列的正下方添加新行?感谢。
这是我的代码
foreach($anggota as $data)
$excel->setActiveSheetIndex(0)->setCellValue('A'.$numrow, $no);
$excel->setActiveSheetIndex(0)->setCellValue('B'.$numrow, $data->tgl_daftar);
$excel->setActiveSheetIndex(0)->setCellValue('C'.$numrow, $data->kd_anggota);
$excel->setActiveSheetIndex(0)->setCellValue('D'.$numrow, $data->nm_anggota);
$excel->setActiveSheetIndex(0)->setCellValue('E'.$numrow, $data->nm_dinas);
$excel->setActiveSheetIndex(0)->setCellValue('F'.$numrow, $data->nm_simpanan);
$excel->setActiveSheetIndex(0)->setCellValue('G'.$numrow, $data->nominal_simpanan);
$excel->setActiveSheetIndex(0)->setCellValue('H'.$numrow, $data->keterangan);
$excel->getActiveSheet()->getStyle('A'.$numrow)->applyFromArray($style_row_center);
$excel->getActiveSheet()->getStyle('B'.$numrow)->applyFromArray($style_row_center);
$excel->getActiveSheet()->getStyle('C'.$numrow)->applyFromArray($style_row_center);
$excel->getActiveSheet()->getStyle('D'.$numrow)->applyFromArray($style_row);
$excel->getActiveSheet()->getStyle('E'.$numrow)->applyFromArray($style_row);
$excel->getActiveSheet()->getStyle('F'.$numrow)->applyFromArray($style_row);
$excel->getActiveSheet()->getStyle('G'.$numrow)->applyFromArray($style_row);
$excel->getActiveSheet()->getStyle('H'.$numrow)->applyFromArray($style_row);
$no++;
$numrow++;
}
//here i want to add new row but i don't know how many rows result created by the looping...