Beispiel #1
0
 public void TestGetSetPatternType()
 {
     CT_Fill ctFill = new CT_Fill();
     XSSFCellFill cellFill = new XSSFCellFill(ctFill);
     CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill();
     ctPatternFill.patternType = (ST_PatternType.solid);
     Assert.AreEqual(ST_PatternType.solid, cellFill.GetPatternType());
 }
Beispiel #2
0
 public void TestGetNotModifies()
 {
     CT_Fill ctFill = new CT_Fill();
     XSSFCellFill cellFill = new XSSFCellFill(ctFill);
     CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill();
     ctPatternFill.patternType = (ST_PatternType.darkDown);
     Assert.AreEqual(ST_PatternType.darkDown, cellFill.GetPatternType());
 }
Beispiel #3
0
 public void TestGetFillForegroundColor()
 {
     CT_Fill ctFill = new CT_Fill();
     XSSFCellFill cellFill = new XSSFCellFill(ctFill);
     CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill();
     CT_Color fgColor = ctPatternFill.AddNewFgColor();
     Assert.IsNotNull(cellFill.GetFillForegroundColor());
     fgColor.indexed = 8;
     fgColor.indexedSpecified = true;
     Assert.AreEqual(8, cellFill.GetFillForegroundColor().Indexed);
 }
Beispiel #4
0
        public void SetUp()
        {
            stylesTable = new StylesTable();

            ctStylesheet = stylesTable.GetCTStylesheet();

            ctBorderA = new CT_Border();
            XSSFCellBorder borderA = new XSSFCellBorder(ctBorderA);
            long borderId = stylesTable.PutBorder(borderA);
            Assert.AreEqual(1, borderId);

            XSSFCellBorder borderB = new XSSFCellBorder();
            Assert.AreEqual(1, stylesTable.PutBorder(borderB));

            ctFill = new CT_Fill();
            XSSFCellFill fill = new XSSFCellFill(ctFill);
            long fillId = stylesTable.PutFill(fill);
            Assert.AreEqual(2, fillId);

            ctFont = new CT_Font();
            XSSFFont font = new XSSFFont(ctFont);
            long fontId = stylesTable.PutFont(font);
            Assert.AreEqual(1, fontId);

            cellStyleXf = ctStylesheet.AddNewCellStyleXfs().AddNewXf();
            cellStyleXf.borderId = 1;
            cellStyleXf.fillId = 1;
            cellStyleXf.fontId = 1;

            cellXfs = ctStylesheet.AddNewCellXfs();
            cellXf = cellXfs.AddNewXf();
            cellXf.xfId = (1);
            cellXf.borderId = (1);
            cellXf.fillId = (1);
            cellXf.fontId = (1);
            stylesTable.PutCellStyleXf(cellStyleXf);
            stylesTable.PutCellXf(cellXf);
            cellStyle = new XSSFCellStyle(1, 1, stylesTable, null);

            Assert.IsNotNull(stylesTable.GetFillAt(1).GetCTFill().patternFill);
            Assert.AreEqual(ST_PatternType.darkGray, stylesTable.GetFillAt(1).GetCTFill().patternFill.patternType);
        }
Beispiel #5
0
 public int PutFill(XSSFCellFill fill)
 {
     int idx = fills.IndexOf(fill);
     if (idx != -1)
     {
         return idx;
     }
     fills.Add(fill);
     return fills.Count - 1;
 }