phpSpreadSheet - setWorkbookPassword

Hi,
same with excel, can get it to readonly, but not password protect to open:

                    $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("$infile");                        
                    
                    $spreadsheet->getSecurity()->setRevisionsPassword("$encryption_key", false);
                    $spreadsheet->getSecurity()->setWorkbookPassword("$encryption_key", false);
                    $spreadsheet->getSecurity()->setLockWindows(true);                        
                    $spreadsheet->getSecurity()->setLockStructure(true);
                                            
                    $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
                    $writer->save("$infile");

thanks,

and for some reason when you look at the password on the spreadsheet object its set to: DC02 — no cluetried differt positions for the calls also:

                    $reader = \PhpOffice\PhpSpreadsheet\IOFactory::load("$infile");                                                
                    
                    $reader->getActiveSheet()->getProtection()->setSheet(true);
                    $reader->getSecurity()->setRevisionsPassword("$encryption_key");
                    $reader->getSecurity()->setWorkbookPassword("$encryption_key");
                                                                    
                    $reader->getSecurity()->setLockWindows(true);                        
                    $reader->getSecurity()->setLockStructure(true);
                                            
                    $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($reader);
                    $writer->save("$infile");

was able to protect the active sheet with$reader->getActiveSheet()->getProtection()->setPassword(“$encryption_key”);

but need to have it protected on opening…

You better post to https://github.com/PHPOffice/PhpSpreadsheet/issues.