php - Hide formulas in PHPExcel -


ok here problem. have following code:

$excel = phpexcel_iofactory::createreader('excel2007'); $objphpexcel = $excel->load($template); $objphpexcel->setactivesheetindex(0); $sheet = $objphpexcel->getactivesheet();  //filling sheet tons of info  $sheet->getprotection()->setpassword('youwishuknew'); $sheet->getprotection()->setsheet(true);  $objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel2007'); $objwriter->save('php://output'); 

it loads template stored in $template (duh) , populates data.

here problem. template had formulas locked, in cells weren't selectable.

after re-population lock gone (so set again, no problem here) when open re-populated sheet can see formulas!

my question is: there way lock cells (make them unselectable) or hide formulas (like excel option in format cells -> protection -> hidden)?

ps: checked other questions , didn't find answer question.

you should use

$sheet->getstyle('c'.$riga)       ->getprotection()       ->sethidden(           phpexcel_style_protection::protection_protected       ); 

let me know if looking for


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -