Beispiel #1
0
        public int PutStyle(XSSFCellStyle style)
        {
            CT_Xf mainXF = style.GetCoreXf();

            if (!xfs.Contains(mainXF))
            {
                xfs.Add(mainXF);
            }
            return(xfs.IndexOf(mainXF));
        }
Beispiel #2
0
        public int PutStyle(XSSFCellStyle style)
        {
            CT_Xf coreXf = style.GetCoreXf();

            if (!this.xfs.Contains(coreXf))
            {
                this.xfs.Add(coreXf);
            }
            return(this.xfs.IndexOf(coreXf));
        }
Beispiel #3
0
        public void TestGetSetBorderBottom()
        {
            //default values
            Assert.AreEqual(BorderStyle.None, cellStyle.BorderBottom);

            int num = stylesTable.GetBorders().Count;

            cellStyle.BorderBottom = (BorderStyle.Medium);
            Assert.AreEqual(BorderStyle.Medium, cellStyle.BorderBottom);
            //a new border has been Added
            Assert.AreEqual(num + 1, stylesTable.GetBorders().Count);
            //id of the Created border
            int borderId = (int)cellStyle.GetCoreXf().borderId;

            Assert.IsTrue(borderId > 0);
            //check Changes in the underlying xml bean
            CT_Border ctBorder = stylesTable.GetBorderAt(borderId).GetCTBorder();

            Assert.AreEqual(ST_BorderStyle.medium, ctBorder.bottom.style);

            num = stylesTable.GetBorders().Count;
            //setting the same border multiple times should not change borderId
            for (int i = 0; i < 3; i++)
            {
                cellStyle.BorderBottom = (BorderStyle.Medium);
                Assert.AreEqual(BorderStyle.Medium, cellStyle.BorderBottom);
            }
            Assert.AreEqual((uint)borderId, cellStyle.GetCoreXf().borderId);
            Assert.AreEqual(num, stylesTable.GetBorders().Count);
            Assert.AreSame(ctBorder, stylesTable.GetBorderAt(borderId).GetCTBorder());

            //setting border to none Removes the <bottom> element
            cellStyle.BorderBottom = (BorderStyle.None);
            Assert.AreEqual(num, stylesTable.GetBorders().Count);
            borderId = (int)cellStyle.GetCoreXf().borderId;
            ctBorder = stylesTable.GetBorderAt(borderId).GetCTBorder();
            Assert.IsFalse(ctBorder.IsSetBottom());
        }