Wednesday 26 July 2017

PhpSpreadsheet : Protected Cells

Status : Draft

Berikut hanya potongan-potongan kode saja :

//style cell yang dapat diedit
$editable_cell_style = array(
 'fill' => array(
  'type' => PHPExcel_Style_Fill::FILL_SOLID,
  'color' => array('rgb' => '66ff99')
  )
);

//protect all cell by default
$sheet->getProtection()->setPassword('amanah');
$sheet->getProtection()->setSheet(true);

$sheet->getStyle('C6')->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
$sheet->getStyle('C6')->applyFromArray($editable_cell_style);

//sembunyikan kolom A
$sheet->getColumnDimension("A")->setVisible(false);

No comments:

Post a Comment