How can one lock or make specific cell or range of excel cells read only using phpExcel or just with php after exporting data to those cells say
from A17:f45?
See section 4.6.26 of the Developer Documentation
$objPHPExcel->getActiveSheet()
->getStyle('A17:F45')
->getProtection()
->setLocked(
PHPExcel_Style_Protection::PROTECTION_PROTECTED
);
before, set protected property for the sheet
$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // Needs to be set to true in order to
$objPHPExcel->getActiveSheet()
->getStyle('A17:F45')
->getProtection()
->setLocked(
PHPExcel_Style_Protection::PROTECTION_PROTECTED
);
regards
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.