Пример #1
0
        internal SLBorderProperties Clone()
        {
            SLBorderProperties bp = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);

            bp.HasColor       = this.HasColor;
            bp.clrReal        = this.clrReal.Clone();
            bp.HasBorderStyle = this.HasBorderStyle;
            bp.vBorderStyle   = this.vBorderStyle;

            return(bp);
        }
Пример #2
0
        internal static string WriteToXmlTag(string BorderTag, SLBorderProperties bp)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<x:{0}", BorderTag);
            if (bp.HasBorderStyle)
            {
                sb.AppendFormat(" style=\"{0}\"", bp.GetBorderStyleAttribute(bp.BorderStyle));
            }

            if (bp.HasColor)
            {
                sb.Append("><x:color");
                if (bp.clrReal.Auto != null)
                {
                    sb.AppendFormat(" auto=\"{0}\"", bp.clrReal.Auto.Value ? "1" : "0");
                }
                if (bp.clrReal.Indexed != null)
                {
                    sb.AppendFormat(" indexed=\"{0}\"", bp.clrReal.Indexed.Value);
                }
                if (bp.clrReal.Rgb != null)
                {
                    sb.AppendFormat(" rgb=\"{0}\"", bp.clrReal.Rgb);
                }
                if (bp.clrReal.Theme != null)
                {
                    sb.AppendFormat(" theme=\"{0}\"", bp.clrReal.Theme.Value);
                }
                if (bp.clrReal.Tint != null)
                {
                    sb.AppendFormat(" tint=\"{0}\"", bp.clrReal.Tint.Value);
                }
                sb.AppendFormat(" /></x:{0}>", BorderTag);
            }
            else
            {
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Пример #3
0
        /// <summary>
        /// Form SLBorder from DocumentFormat.OpenXml.Spreadsheet.Border class.
        /// </summary>
        /// <param name="border">The source DocumentFormat.OpenXml.Spreadsheet.Border class.</param>
        public void FromBorder(Border border)
        {
            this.SetAllNull();

            if (border.LeftBorder != null)
            {
                HasLeftBorder     = true;
                this.bpLeftBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpLeftBorder.FromBorderPropertiesType(border.LeftBorder);
            }

            if (border.RightBorder != null)
            {
                HasRightBorder     = true;
                this.bpRightBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpRightBorder.FromBorderPropertiesType(border.RightBorder);
            }

            if (border.TopBorder != null)
            {
                HasTopBorder     = true;
                this.bpTopBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpTopBorder.FromBorderPropertiesType(border.TopBorder);
            }

            if (border.BottomBorder != null)
            {
                HasBottomBorder     = true;
                this.bpBottomBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpBottomBorder.FromBorderPropertiesType(border.BottomBorder);
            }

            if (border.DiagonalBorder != null)
            {
                HasDiagonalBorder     = true;
                this.bpDiagonalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpDiagonalBorder.FromBorderPropertiesType(border.DiagonalBorder);
            }

            if (border.VerticalBorder != null)
            {
                HasVerticalBorder     = true;
                this.bpVerticalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpVerticalBorder.FromBorderPropertiesType(border.VerticalBorder);
            }

            if (border.HorizontalBorder != null)
            {
                HasHorizontalBorder     = true;
                this.bpHorizontalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpHorizontalBorder.FromBorderPropertiesType(border.HorizontalBorder);
            }

            if (border.DiagonalUp != null)
            {
                this.DiagonalUp = border.DiagonalUp.Value;
            }
            else
            {
                this.DiagonalUp = null;
            }

            if (border.DiagonalDown != null)
            {
                this.DiagonalDown = border.DiagonalDown.Value;
            }
            else
            {
                this.DiagonalDown = null;
            }

            if (border.Outline != null)
            {
                this.Outline = border.Outline.Value;
            }
            else
            {
                this.Outline = null;
            }

            Sync();
        }
Пример #4
0
 /// <summary>
 /// Remove any existing horizontal border.
 /// </summary>
 public void RemoveHorizontalBorder()
 {
     this.bpHorizontalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasHorizontalBorder     = false;
 }
Пример #5
0
 /// <summary>
 /// Remove any existing vertical border.
 /// </summary>
 public void RemoveVerticalBorder()
 {
     this.bpVerticalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasVerticalBorder     = false;
 }
Пример #6
0
 /// <summary>
 /// Remove any existing bottom border.
 /// </summary>
 public void RemoveBottomBorder()
 {
     this.bpBottomBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasBottomBorder     = false;
 }
Пример #7
0
 /// <summary>
 /// Remove any existing right border.
 /// </summary>
 public void RemoveRightBorder()
 {
     this.bpRightBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasRightBorder     = false;
 }
Пример #8
0
        /// <summary>
        /// Form SLBorder from DocumentFormat.OpenXml.Spreadsheet.Border class.
        /// </summary>
        /// <param name="border">The source DocumentFormat.OpenXml.Spreadsheet.Border class.</param>
        public void FromBorder(Border border)
        {
            this.SetAllNull();

            if (border.LeftBorder != null)
            {
                HasLeftBorder = true;
                this.bpLeftBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpLeftBorder.FromBorderPropertiesType(border.LeftBorder);
            }

            if (border.RightBorder != null)
            {
                HasRightBorder = true;
                this.bpRightBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpRightBorder.FromBorderPropertiesType(border.RightBorder);
            }

            if (border.TopBorder != null)
            {
                HasTopBorder = true;
                this.bpTopBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpTopBorder.FromBorderPropertiesType(border.TopBorder);
            }

            if (border.BottomBorder != null)
            {
                HasBottomBorder = true;
                this.bpBottomBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpBottomBorder.FromBorderPropertiesType(border.BottomBorder);
            }

            if (border.DiagonalBorder != null)
            {
                HasDiagonalBorder = true;
                this.bpDiagonalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpDiagonalBorder.FromBorderPropertiesType(border.DiagonalBorder);
            }

            if (border.VerticalBorder != null)
            {
                HasVerticalBorder = true;
                this.bpVerticalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpVerticalBorder.FromBorderPropertiesType(border.VerticalBorder);
            }

            if (border.HorizontalBorder != null)
            {
                HasHorizontalBorder = true;
                this.bpHorizontalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
                this.bpHorizontalBorder.FromBorderPropertiesType(border.HorizontalBorder);
            }

            if (border.DiagonalUp != null) this.DiagonalUp = border.DiagonalUp.Value;
            else this.DiagonalUp = null;

            if (border.DiagonalDown != null) this.DiagonalDown = border.DiagonalDown.Value;
            else this.DiagonalDown = null;

            if (border.Outline != null) this.Outline = border.Outline.Value;
            else this.Outline = null;

            Sync();
        }
Пример #9
0
        internal static string WriteToXmlTag(string BorderTag, SLBorderProperties bp)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<x:{0}", BorderTag);
            if (bp.HasBorderStyle)
            {
                sb.AppendFormat(" style=\"{0}\"", bp.GetBorderStyleAttribute(bp.BorderStyle));
            }

            if (bp.HasColor)
            {
                sb.Append("><x:color");
                if (bp.clrReal.Auto != null) sb.AppendFormat(" auto=\"{0}\"", bp.clrReal.Auto.Value ? "1" : "0");
                if (bp.clrReal.Indexed != null) sb.AppendFormat(" indexed=\"{0}\"", bp.clrReal.Indexed.Value);
                if (bp.clrReal.Rgb != null) sb.AppendFormat(" rgb=\"{0}\"", bp.clrReal.Rgb);
                if (bp.clrReal.Theme != null) sb.AppendFormat(" theme=\"{0}\"", bp.clrReal.Theme.Value);
                if (bp.clrReal.Tint != null) sb.AppendFormat(" tint=\"{0}\"", bp.clrReal.Tint.Value);
                sb.AppendFormat(" /></x:{0}>", BorderTag);
            }
            else
            {
                sb.Append(" />");
            }

            return sb.ToString();
        }
Пример #10
0
 /// <summary>
 /// Remove any existing horizontal border.
 /// </summary>
 public void RemoveHorizontalBorder()
 {
     this.bpHorizontalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasHorizontalBorder = false;
 }
Пример #11
0
 /// <summary>
 /// Remove any existing vertical border.
 /// </summary>
 public void RemoveVerticalBorder()
 {
     this.bpVerticalBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasVerticalBorder = false;
 }
Пример #12
0
 /// <summary>
 /// Remove any existing bottom border.
 /// </summary>
 public void RemoveBottomBorder()
 {
     this.bpBottomBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasBottomBorder = false;
 }
Пример #13
0
 /// <summary>
 /// Remove any existing right border.
 /// </summary>
 public void RemoveRightBorder()
 {
     this.bpRightBorder = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
     HasRightBorder = false;
 }
Пример #14
0
        internal SLBorderProperties Clone()
        {
            SLBorderProperties bp = new SLBorderProperties(this.listThemeColors, this.listIndexedColors);
            bp.HasColor = this.HasColor;
            bp.clrReal = this.clrReal.Clone();
            bp.HasBorderStyle = this.HasBorderStyle;
            bp.vBorderStyle = this.vBorderStyle;

            return bp;
        }