예제 #1
0
        internal BorderXmlWrapper Copy()
        {
            BorderXmlWrapper newBorder = new BorderXmlWrapper();

            newBorder.Bottom       = this._Bottom.Copy();
            newBorder.Diagonal     = this._Diagonal.Copy();
            newBorder.Left         = this._Left.Copy();
            newBorder.Right        = this._Right.Copy();
            newBorder.Top          = this._Top.Copy();
            newBorder.DiagonalUp   = this._DiagonalUp;
            newBorder.DiagonalDown = this._DiagonalDown;

            return(newBorder);
        }
예제 #2
0
        private static XElement WriteBorder(BorderXmlWrapper border)
        {
            XElement borderXml = new XElement(ExcelCommon.Schema_WorkBook_Main + "border");

            if (border.DiagonalDown)
                borderXml.Add(new XAttribute("diagonalDown", "1"));

            if (border.DiagonalUp)
                borderXml.Add(new XAttribute("diagonalUp", "1"));
            if (border.Left != null)
            {
                XElement element = new XElement(ExcelCommon.Schema_WorkBook_Main + "left");
                WriteBorderItem(border.Left, element);
                borderXml.Add(element);
            }
            if (border.Right != null)
            {
                XElement element = new XElement(ExcelCommon.Schema_WorkBook_Main + "right");
                WriteBorderItem(border.Right, element);
                borderXml.Add(element);
            }
            if (border.Top != null)
            {
                XElement element = new XElement(ExcelCommon.Schema_WorkBook_Main + "top");
                WriteBorderItem(border.Top, element);
                borderXml.Add(element);
            }
            if (border.Bottom != null)
            {
                XElement element = new XElement(ExcelCommon.Schema_WorkBook_Main + "bottom");
                WriteBorderItem(border.Bottom, element);
                borderXml.Add(element);
            }
            if (border.Diagonal != null)
            {
                XElement element = new XElement(ExcelCommon.Schema_WorkBook_Main + "diagonal");
                WriteBorderItem(border.Diagonal, element);
                borderXml.Add(element);
            }

            return borderXml;
        }
예제 #3
0
 /// <summary>
 /// FileName:styles.xml
 /// <para>NodePath:styleSheet/borders</para>
 /// </summary>
 /// <param name="root"></param>
 /// <returns></returns>
 public void ReadStyles_borders(WorkBookStylesWrapper target, XElement item)
 {
     foreach (XElement border in item.Nodes())
     {
         BorderXmlWrapper borderObj = new BorderXmlWrapper();
         ReadStyles_border(borderObj, border);
         target.Borders.Add(borderObj);
     }
 }
예제 #4
0
        /// <summary>
        /// FileName:styles.xml
        /// <para>NodePath:styleSheet/borders/border</para>
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        public void ReadStyles_border(BorderXmlWrapper target, XElement item)
        {
            if (item.Attribute("diagonalUp") != null)
            {
                target.DiagonalUp = string.Compare(item.Attribute("diagonalUp").Value, "1") == 1 ? true : false;
            }

            foreach (XElement borderSubNode in item.Nodes())
            {
                switch (borderSubNode.Name.LocalName)
                {
                    case "left":
                        target.Left = new BorderItemXmlWrapper();
                        ReadStyles_borderitem(target.Left, borderSubNode);
                        break;
                    case "right":
                        target.Right = new BorderItemXmlWrapper();
                        ReadStyles_borderitem(target.Right, borderSubNode);
                        break;
                    case "top":
                        target.Top = new BorderItemXmlWrapper();
                        ReadStyles_borderitem(target.Top, borderSubNode);
                        break;
                    case "bottom":
                        target.Bottom = new BorderItemXmlWrapper();
                        ReadStyles_borderitem(target.Bottom, borderSubNode);
                        break;
                    case "diagonal":
                        target.Diagonal = new BorderItemXmlWrapper();
                        ReadStyles_borderitem(target.Diagonal, borderSubNode);
                        break;
                }
            }
        }
예제 #5
0
        internal BorderXmlWrapper Copy()
        {
            BorderXmlWrapper newBorder = new BorderXmlWrapper();

            newBorder.Bottom = this._Bottom.Copy();
            newBorder.Diagonal = this._Diagonal.Copy();
            newBorder.Left = this._Left.Copy();
            newBorder.Right = this._Right.Copy();
            newBorder.Top = this._Top.Copy();
            newBorder.DiagonalUp = this._DiagonalUp;
            newBorder.DiagonalDown = this._DiagonalDown;

            return newBorder;

        }