You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When saving a modified spreadsheet with legacyDrawing as xlsx. I expect to still be able to save newly created VMLComments.
What is the current behavior?
Currently when saving a check is made for an existing legacyDrawing and as a result writeVMLComments is never called. This makes it impossible to hide newly created comments.
What are the steps to reproduce?
Have an existing xlsx file containing VML drawings.
Load file and add comments
set visibility of comments to false
Save file and when loading in an excel file reader, the comments are not hidden
The handling of legacyDrawing is a consequence of PR #3130, which enabled the passing through of form controls if a spreadsheet was loaded and subsequently saved. Your problem is an unintended consequence of that change for spreadsheets with comments but without form controls. There are at least 2 possible approaches to rectifying it. Adding the ability to remove legacyDrawings from worksheets is probably pretty easy. Analyzing the legacyDrawings and automatically removing them if they contain only notes (with no form control elements) is a lot more difficult, but probably a more sensible way to approach the problem. I will add it to my to-do list, but I may not be able to get to it quickly.
oleibman
added a commit
to oleibman/PhpSpreadsheet
that referenced
this issue
Aug 1, 2024
Fix issue PHPOffice#4105. Passing through form controls from load to save was part of the limited support added with PR PHPOffice#3130. However, the legacyDrawing vml, which is a crucial piece of that change, often contains a description only of notes (comments) with no form control contents. Since legacyDrawing is constructed by Xlsx Writer when it doesn't already exist, Xlsx Reader should not interfere with that ability - it should save the contents of legacyDrawing only when it appears to not consist merely of note descriptions.
It should also be an option to delete the legacyDrawing vml before saving. This allows one to add comments, at the cost of losing form controls. A method `deleteLegacyDrawing` is added to Spreadsheet to permit this.
This is:
What is the expected behavior?
When saving a modified spreadsheet with legacyDrawing as xlsx. I expect to still be able to save newly created VMLComments.
What is the current behavior?
Currently when saving a check is made for an existing legacyDrawing and as a result writeVMLComments is never called. This makes it impossible to hide newly created comments.
What are the steps to reproduce?
Have an existing xlsx file containing VML drawings.
Load file and add comments
set visibility of comments to false
Save file and when loading in an excel file reader, the comments are not hidden
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Only tested with Xlsx
Which versions of PhpSpreadsheet and PHP are affected?
Currently using php 8,2, PhpSpreadsheet 2.1.0
The text was updated successfully, but these errors were encountered: