예제 #1
0
파일: CT_Border.cs 프로젝트: kahinke/npoi
 public static CT_Border Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Border ctObj = new CT_Border();
     ctObj.diagonalUp = XmlHelper.ReadBool(node.Attributes["diagonalUp"]);
     ctObj.diagonalDown = XmlHelper.ReadBool(node.Attributes["diagonalDown"]);
     ctObj.outline = XmlHelper.ReadBool(node.Attributes["outline"]);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "left")
             ctObj.left = CT_BorderPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "right")
             ctObj.right = CT_BorderPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "top")
             ctObj.top = CT_BorderPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "bottom")
             ctObj.bottom = CT_BorderPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "diagonal")
             ctObj.diagonal = CT_BorderPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "vertical")
             ctObj.vertical = CT_BorderPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "horizontal")
             ctObj.horizontal = CT_BorderPr.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
예제 #2
0
파일: CT_Borders.cs 프로젝트: kahinke/npoi
 public CT_Border AddNewBorder()
 {
     if (this.borderField == null)
         this.borderField = new List<CT_Border>();
     CT_Border border = new CT_Border();
     this.borderField.Add(border);
     return border;
 }
예제 #3
0
파일: CT_Border.cs 프로젝트: kenlen/npoi
 public CT_Border Copy()
 {
     CT_Border obj = new CT_Border();
     obj.bottomField = this.bottomField;
     obj.topField = this.topField;
     obj.rightField = this.rightField;
     obj.leftField = this.leftField;
     obj.horizontalField = this.horizontalField;
     obj.verticalField = this.verticalField;
     obj.outlineField = this.outlineField;
     return obj;
 }
예제 #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);
        }
예제 #5
0
        /**
         * Get a <b>copy</b> of the currently used CT_Border, if none is used, return a new instance.
         */
        private CT_Border GetCTBorder()
        {
            CT_Border ctBorder;
            if (_cellXf.applyBorder)
            {
                int idx = (int)_cellXf.borderId;
                XSSFCellBorder cf = _stylesSource.GetBorderAt(idx);

                ctBorder = (CT_Border)cf.GetCTBorder();
            }
            else
            {
                ctBorder = new CT_Border();
                ctBorder.AddNewLeft();
                ctBorder.AddNewRight();
                ctBorder.AddNewTop();
                ctBorder.AddNewBottom();
                ctBorder.AddNewDiagonal();
            }
            return ctBorder;
        }
예제 #6
0
 /*package*/
 internal XSSFBorderFormatting(CT_Border border)
 {
     _border = border;
 }
예제 #7
0
파일: Styles.cs 프로젝트: kenlen/npoi
 public CT_Border AddNewBorder()
 {
     CT_Border border = new CT_Border();
     this.borderField = border;
     return border;
 }
예제 #8
0
파일: StylesTable.cs 프로젝트: eatage/npoi
 private static CT_Border CreateDefaultBorder()
 {
     CT_Border ctBorder = new CT_Border();
     ctBorder.AddNewLeft();
     ctBorder.AddNewRight();
     ctBorder.AddNewTop();
     ctBorder.AddNewBottom();
     ctBorder.AddNewDiagonal();
     return ctBorder;
 }
예제 #9
0
        public CT_Border Copy()
        {
            CT_Border obj = new CT_Border();
            obj.bottomField = this.bottomField == null ? null : this.bottomField.Copy();
            obj.topField = this.topField == null ? null : this.topField.Copy();
            obj.rightField = this.rightField == null ? null : this.rightField.Copy();
            obj.leftField = this.leftField == null ? null : this.leftField.Copy();

            obj.diagonalField = this.diagonalField == null ? null : this.diagonalField.Copy();
            obj.verticalField = this.verticalField == null ? null : this.verticalField.Copy();
            obj.horizontalField = this.horizontalField == null ? null : this.horizontalField.Copy();

            obj.diagonalUpField = this.diagonalUpField;
            obj.diagonalUpFieldSpecified = this.diagonalUpFieldSpecified;
            obj.diagonalDownField = this.diagonalDownField;
            obj.diagonalDownFieldSpecified = this.diagonalDownFieldSpecified;
            obj.outlineField = this.outlineField;
            return obj;
        }
예제 #10
0
 /**
  * Creates a new, empty Cell Border.
  * You need to attach this to the Styles Table
  */
 public XSSFCellBorder()
 {
     border = new CT_Border();
 }
예제 #11
0
 /**
  * Creates a Cell Border from the supplied XML defInition
  */
 public XSSFCellBorder(CT_Border border)
 {
     this.border = border;
 }
예제 #12
0
        /**
         * Creates a Cell Border from the supplied XML defInition
         */
        public XSSFCellBorder(CT_Border border, ThemesTable theme)
            : this(border)
        {

            this._theme = theme;
        }
예제 #13
0
        /**
         * Get a <b>copy</b> of the currently used CT_Border, if none is used, return a new instance.
         */
        public CT_Border GetCTBorder()
        {
            CT_Border ctBorder;
            if (_cellXf.applyBorder)
            {
                int idx = (int)_cellXf.borderId;
                XSSFCellBorder cf = _stylesSource.GetBorderAt(idx);

                ctBorder = (CT_Border)cf.GetCTBorder().Copy();
            }
            else
            {
                ctBorder = new CT_Border();
            }
            return ctBorder;
        }
예제 #14
0
 public CT_Border Copy()
 {
     CT_Border obj = new CT_Border();
     if (bottomField != null)
     {
         obj.bottomField = bottomField.Copy();
     }
     if (topField != null)
     {
         obj.topField = topField.Copy();
     }
     if (rightField != null)
     {
         obj.rightField = rightField.Copy();
     }
     if (leftField != null)
     {
         obj.leftField = leftField.Copy();
     }
     if (horizontalField != null)
     {
         obj.horizontalField = horizontalField.Copy();
     }
     if (verticalField != null)
     {
         obj.verticalField = verticalField.Copy();
     }
     if (diagonalField != null)
     {
         obj.diagonalField = diagonalField.Copy();
     }
     obj.diagonalUpField = diagonalUpField;
     obj.diagonalUpSpecified = diagonalUpSpecified;
     obj.diagonalDown = diagonalDown;
     obj.diagonalDownSpecified = diagonalDownSpecified;
     obj.outline = this.outline;
     return obj;
 }