41_Password.php 374 B

123456789101112
  1. <?php
  2. require __DIR__ . '/../Header.php';
  3. $spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
  4. // Set password against the spreadsheet file
  5. $spreadsheet->getSecurity()->setLockWindows(true);
  6. $spreadsheet->getSecurity()->setLockStructure(true);
  7. $spreadsheet->getSecurity()->setWorkbookPassword('secret');
  8. // Save
  9. $helper->write($spreadsheet, __FILE__);