diff --git a/OpenXmlFormats/Spreadsheet/Sheet.cs b/OpenXmlFormats/Spreadsheet/Sheet.cs index e96aa1621..ab36b4473 100644 --- a/OpenXmlFormats/Spreadsheet/Sheet.cs +++ b/OpenXmlFormats/Spreadsheet/Sheet.cs @@ -7387,6 +7387,33 @@ public void Set(CT_DataValidation obj) promptField = obj.promptField; sqrefField = obj.sqrefField; } + + public override bool Equals(object obj) + { + CT_DataValidation o = (CT_DataValidation)obj; + + if (o is null) + { + return false; + } + + return formula1Field == o.formula1Field + && formula2Field == o.formula2Field + && typeField == o.typeField + && errorStyleField == o.errorStyleField + && imeModeField == o.imeModeField + && operatorField == o.operatorField + && allowBlankField == o.allowBlankField + && showDropDownField == o.showDropDownField + && showInputMessageField == o.showInputMessageField + && showErrorMessageField == o.showErrorMessageField + && errorTitleField == o.errorTitleField + && errorField == o.errorField + && promptTitleField == o.promptTitleField + && promptField == o.promptField + && sqrefField == o.sqrefField; + } + [XmlElement(Order = 0)] public string formula1 { diff --git a/main/HSSF/Record/DVRecord.cs b/main/HSSF/Record/DVRecord.cs index bda26c9c8..dda005113 100644 --- a/main/HSSF/Record/DVRecord.cs +++ b/main/HSSF/Record/DVRecord.cs @@ -185,7 +185,36 @@ public int DataType set { this._option_flags = this.opt_data_type.SetValue(this._option_flags, value); } } + public override bool Equals(object obj) + { + if (obj == null || !(obj is DVRecord)) + { + return false; + } + DVRecord dv = (DVRecord)obj; + return DataType == dv.DataType + && ErrorStyle == dv.ErrorStyle + && EmptyCellAllowed == dv.EmptyCellAllowed + && ShowErrorOnInvalidValue == dv.ShowErrorOnInvalidValue + && ShowPromptOnCellSelected == dv.ShowPromptOnCellSelected + && SuppressDropdownArrow == dv.SuppressDropdownArrow + && ListExplicitFormula == dv.ListExplicitFormula + && ConditionOperator == dv.ConditionOperator + && PromptTitle == dv.PromptTitle + && PromptText == dv.PromptText + && ErrorTitle == dv.ErrorTitle + && ErrorText == dv.ErrorText + && ((Formula1 == null && dv.Formula1 == null) + || Formula1 != null && dv.Formula1 != null + && Formula1.ToString() == dv.Formula1.ToString()) + && ((Formula2 == null && dv.Formula2 == null) + || Formula2 != null && dv.Formula2 != null + && Formula2.ToString() == dv.Formula2.ToString()) + && (CellRangeAddress == null && dv.CellRangeAddress == null + || CellRangeAddress != null && dv.CellRangeAddress != null + && CellRangeAddress.ToString() == dv.CellRangeAddress.ToString()); + } /** * Get the condition error style @@ -426,4 +455,4 @@ public override Object Clone() return CloneViaReserialise(); } } -} \ No newline at end of file +}