So the export is only the first line has the value, but if I put the first red box code deleted, second, three, four ... The line will have value.
The first row of values is the title, such as gender, age, and so on.
Second, three, four ... The line is the corresponding gender, age, etc. value.
Ask for help,,, ...
Reply to discussion (solution)
The picture is too small to see clearly
Can't you just stick the code?
For ($m _k=0, $column _num0= ' A '; $m _k< $column _max, $column _num0< ' ZZ '; $column _num0++, $m _k++) {//$objectPHPExcel- >getactivesheet ()->getcolumndimension ($column _NUM0)->setwidth,//$objectPHPExcel Setactivesheetindex (0)->setcellvalue ($column _num0. ' 1 ', $m _arr[$m _k]);//$objectPHPExcel->getactivesheet ()- >getstyle (String) ($column _num0. ' 1 ')->getalignment ()->sethorizontal (phpexcel_style_alignment:: Horizontal_center);} for ($key _num=0; $key _num< $row _max; $key _num++) {$row _num= $key the index of the _num+2;//array is the row number -2$avar_arr=array_filter (explode (' | ', $data [$key _num][' Avar ']); $answer _arr=array_filter (Explode (' | '), $data [$key _num][' aanswer ']); $d _arr=array_combine ($avar _arr, $answer _arr); foreach ($d _arr as $k = + $v) {foreach ($m _arr as $k 1=> $v 1) {if (!isset ($d _arr[$v 1]) {$d _arr[$v 1]= ';}}} Ksort ($d _arr); $d _arr=array_values ($d _arr); for ($column _num= ' A ', $column _num2=1; $column _num< ' ZZ ', $column _num2 <301; $column _num++, $column _num2++) {foreach ($d _arr as $k = $v) {if ($k = = ($column _num2-1)) {$objeCtphpexcel->getactivesheet ()->setcellvalue ($column _num. $row _num, $v); $objectPHPExcel->getactivesheet () ->getstyle (String) ($column _num. $row _num))->getalignment ()->sethorizontal (phpexcel_style_alignment:: Horizontal_center);}}} Header (' Content-type:application/vnd.ms-excel '); Header (' content-disposition:attachment;filename= '. Date (' Ymd-his '). XLS "'); Header (' cache-control:max-age=0 '); $objWriter = Phpexcel_iofactory::createwriter ($objectPHPExcel, ' Excel5 '); $objWriter->save (' php://output ');
@
The picture is too small to see clearly
Can't you just stick the code?
Moderator "That three line is my test time commented out,, help to see,,
The picture is too small to see clearly
Can't you just stick the code?
The first for loop is the value that sets the first row
The second for loop is set two, three, four ... The value of the row
In this way, only the first row is valued, the second, three, four ... Row has no value.
If you comment out the first for loop, the second, three, four ... The line will have value.
How to solve it?