Beispiel #1
0
        public void TestRecalcId()
        {
            HSSFWorkbook wb = new HSSFWorkbook();

            Assert.IsFalse(wb.ForceFormulaRecalculation);

            InternalWorkbook iwb = TestHSSFWorkbook.GetInternalWorkbook(wb);
            int countryPos       = iwb.FindFirstRecordLocBySid(CountryRecord.sid);

            Assert.IsTrue(countryPos != -1);
            // RecalcIdRecord is not present in new workbooks
            Assert.AreEqual(null, iwb.FindFirstRecordBySid(RecalcIdRecord.sid));
            RecalcIdRecord record = iwb.RecalcId;

            Assert.IsNotNull(record);
            Assert.AreSame(record, iwb.RecalcId);

            Assert.AreSame(record, iwb.FindFirstRecordBySid(RecalcIdRecord.sid));
            Assert.AreEqual(countryPos + 1, iwb.FindFirstRecordLocBySid(RecalcIdRecord.sid));

            record.EngineId = (/*setter*/ 100);
            Assert.AreEqual(100, record.EngineId);
            Assert.IsTrue(wb.ForceFormulaRecalculation);

            wb.ForceFormulaRecalculation = (/*setter*/ true); // resets the EngineId flag to zero
            Assert.AreEqual(0, record.EngineId);
            Assert.IsFalse(wb.ForceFormulaRecalculation);

            wb.Close();
        }