rubberchicken
rubberchicken

Reputation: 1322

phpexcel remove the middle border line between 2 cells?

in phpexcel how do i remove the middle border line between 2 cells?

like this pic: pic

it currently shows as: enter image description here

this is my current code:

    $styleArray = array(
  'borders' => array(
    'allborders' => array(
      'style' => PHPExcel_Style_Border::BORDER_DOUBLE
    )
  )
);

$objPHPExcel->getActiveSheet()->getStyle("G".$rownum.":H".$rownum)->applyFromArray($styleArray);
unset($styleArray);

Upvotes: 6

Views: 10793

Answers (2)

Bart
Bart

Reputation: 182

While I agree that your method works @Dagon I feel it's a little messy, instead I would recommend using the 'outline' method. Like so

'borders' => array(
   'outline' => array(
      'style' => PHPExcel_Style_Border::BORDER_DOUBLE
   ),
)

Upvotes: 10

user557846
user557846

Reputation:

specify each side separately for the cells

 'borders' => array(
    'left' => array(
      'style' => PHPExcel_Style_Border::BORDER_DOUBLE,
    ),
    'right' => array(
      'style' => PHPExcel_Style_Border::BORDER_DOUBLE,
    ),
    'bottom' => array(
      'style' => PHPExcel_Style_Border::BORDER_DOUBLE,
    ),
    'top' => array(
      'style' => PHPExcel_Style_Border::BORDER_DOUBLE,
    ), 

one cell will have right 'none' one with have left 'none'

Upvotes: 2

Related Questions