php - Writing and Exporting Excel file Using PHPExcel -


I am trying to fill my Excel sheet with the data I have done. Now I am getting a sheet but I have not only filled one line, it is not receiving the data, though this is my object. I

I was trying my sheet in the same way as this sheet. I am desired sheet

I am trying to write code in this part of the code: < / P>

  public function export ($ set, $ disp_filter) {$ objPHPExcel = new PHPExcel (); $ ObjPHPExcel- & gt; GetProperties () - & gt; Setitle ("official excel test document"); $ StyleArray = array ('font' = & gt; array ('bold' => true, 'color' => array ('RGB' => 'FF 20000'), 'size' = & Gt; 10, 'name' = & gt; wardan ')); $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; GetStyle ('A1') - & gt; ApplyFromArray ($ styleArray); $ Excel_out = array ($ this-> Output SampleName ($ set)); // var_dump ($ excel_out); // Go out; $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; Setel Value ('A1', 'Sample Size and Error Margin'); $ Line count = 2; Forex Currency ($ excel_out $ key = & gt; $ line) {$ colCount = 'A'; $ I = =; // $ line = array ($ set ['name']); // $ ct = $ set ['crosstab'] ['base']; // $ mo = array ($ whistle ['sample'] ['' mo ']); Forex Currency ($ line $ as col_value) {// var_dump ($ col_value); // Go out; $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; Set Call Value ($ colCount. $ RowCount, $ col_value [$ i]) - & gt; GetStyle ($ callout. $ RowCount) - & gt; Applicable gold ($ style array); $ ColCount ++; } $ RowCount ++; $ I ++; } Return $ objPHPExcel; } Protected function outputSampleName ($ set) {foreach ($ set as $ set) {$ CT = $ Set ['crossTabs'] ['base']; $ Line = array ($ set ['name'], $ ct ['sample'] ['mo']. '%'); $ Excel_out [] = $ line; } Return $ excel_out; }  

When I look by var_dump ($ excel_out) I have this data structure:

** Please give me some suggestions on how I can achieve that percentage value in my next line optimized. For now, I can only loop through that sample [name], which is from the array (enthusiasts, hunters, new shooters etc.) ** Thanks in advance

Your array element may be an array, and you are trying to establish these places starvation in cells.

Try setting every cell's $ line in each cell:

  foreach ($ excel_out $ line) {$ ColCount = 'A'; $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; Setcell Value ('a'. $ Punctiquity, $ line [0]) - & gt; Setsel value ('B'. $ RowCount, $ line [1]) - & gt; Setsel value ('C'. Line line, $ line [2]) - & gt; Setsel value ('D'. $ Line command, $ line [3]) - & gt; Setcell value ('e'. $ Punctiquity, $ line [4]); $ ColCount ++; $ ROWCOUNT ++; }  

Note that there is only one element in the first sub-array in $ excel_out you may want to store each $ line Can use the inner loop to cross through.

Edit:

Your answer after viewing the code.

Using Inner Loop:

  Orech ($ excel_out $ key = & gt; $ line) {$ colCount = 'A'; $ I = 0; Forex Currency ($ line $ as col_value) {// var_dump ($ col_value); // Go out; $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; Set cell value ($ colCount. $ RowCount, $ col_value [$ i]); //$objPHPExcel->getActiveSheet()->setCellValue('B'.rowrowCount, $ col_value [1]); //$objPHPExcel->getActiveSheet()->setCellValue('C'.$rowCount, $ col_value [2]); //$objPHPExcel->getActiveSheet()->setCellValue('D'.rowrowCount, $ col_value [3]); //$objPHPExcel->getActiveSheet()->setCellValue('E'.$rowCount, $ col_value [4]); //$objPHPExcel->getActiveSheet()->setCellValue('F'.$rowCount, $ col_value [5]); $ ColCount ++; $ I ++; // $ ROWCOUNT ++; } $ RowCount ++; // $ colCount ++; }  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -