-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better support of xlsm with forms #435
Better support of xlsm with forms #435
Conversation
- load workbookProtection attributes - save loaded pageSetup[r:id] - save loaded sheet's AlternateContent - save loaded unparsed VmlDrawings - save loaded drawing files `rId` - save loaded draw's AlternateContent - save loaded control properties - save loaded printer settings - save loaded unparsed override content types (for ctrlProp,..)
I tried to incorporate this PR in my project because my form elements were discarded by PhpSpreadsheet, and now Excel crashes! |
@jbq Can you share sample of your document? You can erase all private data from it. |
@SailorMax Here are the details: https://www.dropbox.com/sh/xi9lrz42r8jctsd/AAAMCN0FanHKkVVFGrESFp2Za?dl=0 You will find the template XLSM file loaded by PhpSpreadsheet, and the one saved by the library with patch applied, without any extra processing. The latter crashes Excel. |
for cases when source file has drawing-file, but has not draw-elements
@jbq Looks like fixed. Can you check latest update? |
@SailorMax sadly I had to quickly push to production and changed the form controls to plain cells with border styling to make it look like button, along with |
thanks for the contribution, it's been merged with a few tweaks |
This will let users read a file that contains data that are not properly supported and write them back to a new file untouched. - load workbookProtection attributes - save loaded pageSetup[r:id] - save loaded sheet's AlternateContent - save loaded unparsed VmlDrawings - save loaded drawing files `rId` - save loaded draw's AlternateContent - save loaded control properties - save loaded printer settings - save loaded unparsed override content types (for ctrlProp, ...) Closes PHPOffice#435
Fix PHPOffice#3126. A worksheet contained an image in its footer. It could be loaded and saved as another spreadsheet. However, if you tried to load and save that spreadsheet, PhpSpreadsheet would be unable to find the footer image and would therefore throw an exception. This error was introduced a long time ago, in PhpSpreadsheet 1.3.0. The apparent cause of the problem was PR PHPOffice#435, sometime around June 2018. That change was very useful, but it had problems which exposed themselves only with a third generation copy. An additional contributor to the issue at hand was PR PHPOffice#1690 (December 2020), which again exposed itself with a third generation copy. The issue from 1690 is easier to explain and deal with. It added a 'ps' suffix to printer settings resources in Xlsx Reader (to avoid name conflicts), but did not limit itself to a single addition (so subseqent generations would have multiple ps's). It also neglected to add the suffix in Reader/Xlsx/PageSetup. As for 435, it loops through all the worksheet relationships, and uses the last that it finds as the base for header/footer drawings. It has been changed to use only the relationship whose `rId` matches the worksheet's `legacyDrawingHF` `rId`. It also needs a bit extra validation to make sure a drawing exists before adding it to its array of header/footer images. It also meant that Xlsx/Writer/Rels might write an entry with the same rId twice. I have also changed the header/footer image processing to be namespace aware (see PR PHPOffice#3137).
* Generation3 Copy With Image in Footer Fix #3126. A worksheet contained an image in its footer. It could be loaded and saved as another spreadsheet. However, if you tried to load and save that spreadsheet, PhpSpreadsheet would be unable to find the footer image and would therefore throw an exception. This error was introduced a long time ago, in PhpSpreadsheet 1.3.0. The apparent cause of the problem was PR #435, sometime around June 2018. That change was very useful, but it had problems which exposed themselves only with a third generation copy. An additional contributor to the issue at hand was PR #1690 (December 2020), which again exposed itself with a third generation copy. The issue from 1690 is easier to explain and deal with. It added a 'ps' suffix to printer settings resources in Xlsx Reader (to avoid name conflicts), but did not limit itself to a single addition (so subseqent generations would have multiple ps's). It also neglected to add the suffix in Reader/Xlsx/PageSetup. As for 435, it loops through all the worksheet relationships, and uses the last that it finds as the base for header/footer drawings. It has been changed to use only the relationship whose `rId` matches the worksheet's `legacyDrawingHF` `rId`. It also needs a bit extra validation to make sure a drawing exists before adding it to its array of header/footer images. It also meant that Xlsx/Writer/Rels might write an entry with the same rId twice. I have also changed the header/footer image processing to be namespace aware (see PR #3137). * Minor Change I didn't like the way I performed one operation. * Fix Test Array index should not have been constant.
This is:
Checklist:
Why this change is needed?
Collect some currently not supported features of Xlsx when document loaded. And restore them when same document saved. This allow to fill Xlsm templates, which has form elements, macros, printer settings, protected elements and back compatibility drawing, and save result without lost important elements of document.