code: private function writeWorkbookProtection(XMLWriter $objWriter, Spreadsheet $spreadsheet)
      {
          if ($spreadsheet->getSecurity()->isSecurityEnabled()) {
              $objWriter->startElement('workbookProtection');
              $objWriter->writeAttribute('lockRevision', ($spreadsheet->getSecurity()->getLockRevision() ? 'true' : 'false'));
              $objWriter->writeAttribute('lockStructure', ($spreadsheet->getSecurity()->getLockStructure() ? 'true' : 'false'));
              $objWriter->writeAttribute('lockWindows', ($spreadsheet->getSecurity()->getLockWindows() ? 'true' : 'false'));
  
              if ($spreadsheet->getSecurity()->getRevisionsPassword() != '') {
                  $objWriter->writeAttribute('revisionsPassword', $spreadsheet->getSecurity()->getRevisionsPassword());
              }
  
              if ($spreadsheet->getSecurity()->getWorkbookPassword() != '') {
                  $objWriter->writeAttribute('workbookPassword', $spreadsheet->getSecurity()->getWorkbookPassword());
              }
  
              $objWriter->endElement();
          }
      }
docs: Write WorkbookProtection.
  
  @param XMLWriter $objWriter XML Writer
  @param Spreadsheet $spreadsheet