public void TestBug47737() { XSSFWorkbook wb = XSSFTestDataSamples.OpenSampleWorkbook("47737.xlsx"); Assert.AreEqual(2, wb.NumberOfNames); Assert.IsNotNull(wb.GetCalculationChain()); XSSFName nm0 = (XSSFName)wb.GetNameAt(0); Assert.IsTrue(nm0.GetCTName().IsSetLocalSheetId()); Assert.AreEqual(0u, nm0.GetCTName().localSheetId); XSSFName nm1 = (XSSFName)wb.GetNameAt(1); Assert.IsTrue(nm1.GetCTName().IsSetLocalSheetId()); Assert.AreEqual(1u, nm1.GetCTName().localSheetId); wb.RemoveSheetAt(0); Assert.AreEqual(1, wb.NumberOfNames); XSSFName nm2 = (XSSFName)wb.GetNameAt(0); Assert.IsTrue(nm2.GetCTName().IsSetLocalSheetId()); Assert.AreEqual(0u, nm2.GetCTName().localSheetId); //calculation chain is Removed as well Assert.IsNull(wb.GetCalculationChain()); }
/** * Compares this name to the specified object. * The result is <code>true</code> if the argument is XSSFName and the * underlying CTDefinedName bean Equals to the CTDefinedName representing this name * * @param o the object to compare this <code>XSSFName</code> against. * @return <code>true</code> if the <code>XSSFName </code>are Equal; * <code>false</code> otherwise. */ public override bool Equals(Object o) { if (o == this) { return(true); } if (!(o is XSSFName)) { return(false); } XSSFName cf = (XSSFName)o; return(_ctName.name == cf.GetCTName().name&& _ctName.localSheetId == cf.GetCTName().localSheetId); }
public override bool Equals(object o) { if (o == this) { return(true); } if (!(o is XSSFName)) { return(false); } XSSFName xssfName = (XSSFName)o; if (this._ctName.name == xssfName.GetCTName().name) { return((int)this._ctName.localSheetId == (int)xssfName.GetCTName().localSheetId); } return(false); }