函数原型

  1. protection([string $password]);

示例一

  1. $config = ['path' => './tests'];
  2. $fileObject = new \Vtiful\Kernel\Excel($config);
  3. $fileObject = $fileObject->fileName('tutorial.xlsx');
  4. $filePath = $fileObject->header(['name', 'age'])
  5. ->data([
  6. ['viest', 21],
  7. ['wjx', 21]
  8. ])
  9. ->protection() // 启用工作表保护,无密码保护
  10. ->output();

示例二

  1. $config = ['path' => './tests'];
  2. $fileObject = new \Vtiful\Kernel\Excel($config);
  3. $fileObject = $fileObject->fileName('tutorial.xlsx');
  4. $filePath = $fileObject->header(['name', 'age'])
  5. ->data([
  6. ['viest', 21],
  7. ['wjx', 21]
  8. ])
  9. ->protection('viest') // 启用工作表保护,密码保护,密码为:viest
  10. ->output();