问题
I am using office 365 and Excel online (Build 16.0.9403.1875).
and I am creating Microsoft Excel online Add-ins, using Excel javascript API.
How to find the dirty cell/cells from excel sheet using Excel Javascript API.
If a cell is edited by value / formula / format, that became dirty. So I need to find, what are all the cells are dirty(edited) from range of cells.
For Reference, Please find
calculate
method in this link.
Advance Thanks.
回答1:
There is no Excel JavaScript API that will return the dirty cells, but it's a good idea. Please suggest it at Office Developer Voice.
回答2:
Since Excel doesn't natively have a dirty flag, you'll need to produce one via one of two methods:
Catch the cell edit event and record a list of edited cells that are dirty.
Dim Dirty As New Collection
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim sheet As Worksheet
Set sheet = Sh
Dirty.Add (sheet.Name + "!" + Target.Address)
End Sub
OR
When you need the dirty flag, open the saved copy behind the scenes and compare the two to see what has changed.
来源:https://stackoverflow.com/questions/50817709/find-the-dirtyedited-cell-cells-from-excel-sheet-using-excel-javascript-api