title: How to put borders around my output in PHPexcel in a Dynamic way
body: <p>Can anyone help me how to put borders around in my output arrays in my report in excel using PHPexcel.</p>
  
  <p>I read the documentation but the example is in Static and you need to set the number already. </p>
  
  <p>I want to do is when all arrays is transferred to excel all of them will have borders.</p>
  
  <p>The problem is my current code is not working can anyone help me with this please.</p>
  
  <pre><code>$result = array();
  
         for ( $n = 1; $n &lt;=35; $n++ ){
  
          $name = isset($_POST['name'.$n]) ? $_POST['name'.$n] : "";
                if(!$name)
                {
                   continue;
                } 
  
          $no = 0+$n;
          $aic = isset($_POST['aic'.$n]) ? $_POST['aic'.$n] : "";
          $repcode = isset($_POST['repcode']) ? $_POST['repcode'] : "";
          $optA = isset($_POST['optA'.$n]) ? $_POST['optA'.$n] : "";
          $optB = isset($_POST['optB'.$n]) ? $_POST['optB'.$n] : "";
          $optC = isset($_POST['optC'.$n]) ? $_POST['optC'.$n] : "";
          $optD = isset($_POST['optD'.$n]) ? $_POST['optD'.$n] : "";
          $total = isset($_POST['total'.$n]) ? $_POST['total'.$n] : "";
          $remarks = '';
  
          $result[] = array(
                $no,
                "PRO13325-".$aic,
                $repcode,
                $name,
                $optA,
                $optB,
                $optC,
                $optD,
                $total,
                $remarks );
          }
  
  
  
  $row = 5;
      foreach($result as $rows){
      if (!empty($rows[4])) {
          $borderArray = array(
              'borders' =&gt; array(
              'outline' =&gt; array(
              'style' =&gt; PHPExcel_Style_Border::BORDER_THICK,
              'color' =&gt; array('argb' =&gt; 'FFFF0000'),
                      ),
                  ),
              );
          $objPHPExcel-&gt;getActiveSheet()-&gt;fromArray($rows, null, 'A' . $row)-&gt;applyFromArray($borderArray);
          $row++;
      }
  }
  </code></pre>