Posted 11 January 2018, 12:54 am EST
Hi!
I’m having an issue with the undo operation, this are the steps to reproduce it.
I have an empty spreadsheet and I want create a custom name associated to the cell A1, I want to delete the column 0 or row 0 then I want to undo this operation and as result I want to have the custom name restore back.
Steps:
// Create custom name
spreadsheet.workbook.addCustomName('test_a1', 'Sheet1!$A$1', 0, 0)
spreadsheet.workbook.getCustomName('test_a1').getExpression() //-> result: "{"type":1,"row":0,"column":0,"rowRelative":false,"columnRelative":false,"sf":true}"
spreadsheet.workbook.getActiveSheet().setFormula(0, 2, '=test_a1')
// Delete the column 0 and check the custom name state
spreadsheet.workbook.getActiveSheet().deleteColumns(0, 1)
spreadsheet.workbook.getCustomName('test_a1').getExpression() //-> result: "{"type":5,"value":{"_calcError":"#REF!","_code":23}}"
spreadsheet.workbook.getActiveSheet().getValue(0, 1) //-> result: "{"_calcError":"#REF!","_code":23}"
// I want undo the delete column operation
spreadsheet.workbook.undoManager().undo() //-> result: true
// I will check the custom name that I had associated to the column 0
spreadsheet.workbook.getCustomName('test_a1').getExpression() //-> result: "{"type":5,"value":{"_calcError":"#REF!","_code":23}}"
spreadsheet.workbook.getActiveSheet().getValue(0, 1) //-> result: "{"_calcError":"#REF!","_code":23}"
The result that I’m expecting is get the custom name as I had before the delete column operation.
Do you know any workaround to do that?
Thanks in advance.