> Additionally, I feel it is the developer's sole responsibility to supply an undo function if that is needed.
I completely disagree, Excel is informed of the changes made by the extension to the document itself (via the addin's use of the Excel DOM API to modify the document contents).
> in the additiion. Only the Add-in or scripted extension knows what it did,
> and to what extent changes were made.
It is only true for actions that were performed outside the document (for example on a remote service). These actions will have their own local transactions and the plugin can coordinate these transactions. After all Windows already has an API for coordinating
transactions in distinct services.
> Therefore, it is solely its responsibility to back out those changes.
Which it cannot do on the Excel document content itself, because everything is lost in the Excel Undo buffer, including modifications that were NOT performed by the addin itself.
> I think it is completely unreasonable to expect the application to have any responsibility to perform these functions.
I think it is the responsability of Excel to NOT clear its Undo buffer compeltely from everything that the adding did NOT modify itself and that it did NOT record (and cannot understand or even see if these other actions were performed by another independant
addin.
So the Micosoft assumption in Excel si completely wrong. This is just bad design and clear desire to not develop the necessary transaction support (including with transaction coordination).
Excel is not different from a relational database server for this case, or from a transactional service. It is a database server containing data that can (and should) be historied, and coordinated with other services.
Microsoft can support it in MSSQL, I don't see why it cannot support it too in Office applications (Excel, Word, Publisher, Outlook).
And it's definitely not up to Excel to decice what cannot be safely undone. Clearing the Undo buffer immediately is just... stupid.
And this greatly limits the usability of all addins and the extensibility of Excel if it does not host itself all what only addins can perform (including form input addins, calendar selection addins, email addins : of course you cannot undo the fact that
an email was sent, but it's up to the addin to decide what can be undone in a way that leaves useful data; for example the fact of changing the storage folder of an email by moving it to another one can be undone, while preserving the content of the edited
email and allowing this edit to be undone).
Only the addin can decide how to roll back its own internal actions, but it can also selectively decide to keep or not the changes in the Excel document and this should be extremely easy to do if Excel did not extended the minor edits by the addin to force
them to become major edits to everything else that the adding did not modify.
Finally Excel offers absolutely no stable support for the addin to monitor what has been done to the ducument by Excel itself completely outside what the addin effectively controls (or what it can access to, an addin cannot touch everything in the document,
it is sandboxed for many data items, that are still normally undoable by Excel itself with its builtin edit commands).
As a consequence, using any addin to modify data in a Excel document is extremely dangerous (an accidental click or keystroke in the addin may ruin the document content completely and hours of edits in Excel. With addins, you don't gain any time, you loose
your work time too frequently and users are instructed to NOT embed any addin in their documents.
And anoter argument: if you can save an Excel document with its addins, these saves can be historied and rolled back. The content of the undo buffer should then also be saveable as well in the docuemtn itself or in versions of the document.
Several applications do that without problem (notably version control systems that offer selective commits or rollbacks; they also support branches as well and mechanisms to merge compatible changes in a branch into another branch, and ten to close one branch
as a stable version tat can be exported, for example to create a delivery and release it).