-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Description
This is:
- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the current behavior?
File or sheets lose password for protection after IOFactory::createWriter and save
What are the steps to reproduce?
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
<?php
require __DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object
$spreadsheet = IOFactory::load([Fichier_TEST_MyEcoPlan.xlsx](https://github.com/user-attachments/files/22636812/Fichier_TEST_MyEcoPlan.xlsx));
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$temporaryPathfile = rtrim(sys_get_temp_dir(), \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR.md5(uniqid().mt_rand());
$writer->save($temporaryPathfile);
### What features do you think are causing the issue
- [ ] Reader
- [x] Writer
- [ ] Styles
- [ ] Data Validations
- [ ] Formula Calculations
- [ ] Charts
- [ ] AutoFilter
- [ ] Form Elements
### Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet 4.5.0, PHP8.3
Metadata
Metadata
Assignees
Labels
No labels