Skip to content

CustomXml Parts are not included in Undo/Redo #6415

@James-Gauld-92

Description

@James-Gauld-92

Provide required information needed to triage your issue

When using the undo/redo commands after using an add-in to modify both the worksheet and Custom Xml Parts, only the worksheet changes are Undone/Redone. Leaving potentially stale references to worksheet data in the Custom Xml Parts.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC Desktop
  • Host [Excel, Word, PowerPoint, etc.]: Excel
  • Office version number: 2511
  • Operating System: Windows 11 (25H2)
  • Browser (if using Office on the web): ______

Expected behavior

Created Xml Parts should be deleted/recreated with the worksheet changes.

Current behavior

Worksheet changes are undone/redone but the Custom Xml Parts remain in the state created by the initial add-in action.
The [Content_Types].xml file is also left in the previous state.

Steps to reproduce

  1. Clone https://github.com/James-Gauld-92/OfficeJs-Excel-Undo-CustomXml-Example
  2. Install dependencies and run npm run dev-server
  3. Open Excel and sideload the manifest.
  4. Click show task pane and then Add Current time to current cell and insert to Custom XML Part.
  5. The current time should be inserted to the current cell.
  6. Save the Workbook to a local directory.
  7. Copy the Workbook in Windows Explorer.
  8. Use 7zip to extract the copied Workbook to a folder.
  9. Open the extracted files and navigate to customXml.
  10. Confirm that the latest item{number}.xml contains the correct date inserted in step 5.
  11. Return to Excel and undo the last action.
  12. Resave the workbook.
  13. Repeat steps 7-9.
  14. The customXml item will still be there.
  15. If you use the Redo button at this time, the Cell will get the current time back, but there will still only be the original item{number}.xml

Provide additional details

  1. workbook.customXmlParts.add Is not listed on the unsupported Api's here https://learn.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-undo-capabilities
  2. OneDrive auto save can interfere with this quick test by causing the Workbook file to not synchronise in a timely manner.
  3. We have to copy the Workbook as Excel will keep the workbook locked so 7zip cannot access it, also we want to retain the undo history so we can't close Excel.

Context

We use both a hidden sheet and the custom xml parts to track metadata related to the cell contents. Before Api 1.20 the undo history was cleared whenever the Add-in performed any actions, so deleting data in the main sheet could only be done in a way that our Add-in could detect and remove the associated metadata. This was done by detecting #REF! in the hidden sheet, or by having the end user use a dedicated delete button in the Add-in.
Now the main sheet and hidden sheet data can be undone leaving the customXml data behind and leaving the Add-in in a corrupted state.

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

Metadata

Metadata

Labels

Area: ExcelIssue related to Excel add-insStatus: in backlogIssue is being tracked in the backlog but timeline for resolution is unknown

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions