/// <summary> /// Remove any existing border style. /// </summary> public void RemoveBorderStyle() { this.vBorderStyle = BorderStyleValues.None; HasBorderStyle = false; }
/// <summary> /// Set the horizontal border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetHorizontalBorder(BorderStyleValues BorderStyle, System.Drawing.Color BorderColor) { this.Border.HorizontalBorder.BorderStyle = BorderStyle; this.Border.HorizontalBorder.Color = BorderColor; }
private void LCreateStyle(string numberFormatCode, double fontSize, string fontName, System.Drawing.Color fontColor , bool fontBold, bool fontItalic, PatternValues fillPattern, System.Drawing.Color fillForeGroundColor, System.Drawing.Color borderLeftColor , BorderStyleValues borderLeftStyleValue, System.Drawing.Color borderBottomColor, BorderStyleValues borderBottomStyleValue, System.Drawing.Color borderRightColor , BorderStyleValues borderRightStyleValue, System.Drawing.Color borderTopColor, BorderStyleValues borderTopStyleValue, HorizontalAlignmentValues alignmentHorizontal, VerticalAlignmentValues alignmentVertical) { if (numberFormatCode != null) { NumberingFormat numberingFormat = new NumberingFormat(); numberingFormat.FormatCode = numberFormatCode; _oNumberingFormat = numberingFormat; } //font Font font = new Font(); FontSize _fontSize = new FontSize() { Val = DoubleValue.FromDouble(fontSize) }; font.Append(_fontSize); if (fontName != null) { FontName _fontName = new FontName() { Val = fontName }; font.Append(_fontName); } if (fontColor != null) { Color _fontColor = new Color() { Rgb = new HexBinaryValue() { Value = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(fontColor.R, fontColor.G, fontColor.B)).Replace("#", "") } }; font.Append(_fontColor); } if (fontBold) { Bold _fontBold = new Bold(); font.Append(_fontBold); } if (fontItalic) { Italic _fontItalic = new Italic(); font.Append(_fontItalic); } _oFont = font; //fill Fill _fontFill = null; if (fillForeGroundColor == null) { _fontFill = new Fill(new PatternFill() { PatternType = fillPattern }); } else { _fontFill = new Fill(new PatternFill( new ForegroundColor() { Rgb = new HexBinaryValue() { Value = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(fillForeGroundColor.R, fillForeGroundColor.G, fillForeGroundColor.B)).Replace("#", "") } } ) { PatternType = PatternValues.Solid }); } _oFill = _fontFill; //border Border _border = new Border(); LeftBorder leftBorder = new LeftBorder() { Style = borderLeftStyleValue }; Color colorLeftBorder = null; if (borderLeftColor != null) { colorLeftBorder = new Color() { Rgb = new HexBinaryValue { Value = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(borderLeftColor.R, borderLeftColor.G, borderLeftColor.B)).Replace("#", "") } }; } else { colorLeftBorder = new Color(); } leftBorder.Append(colorLeftBorder); _border.Append(leftBorder); RightBorder rightBorder = new RightBorder() { Style = borderRightStyleValue }; Color colorRightBorder = null; if (borderRightColor != null) { colorRightBorder = new Color() { Rgb = new HexBinaryValue { Value = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(borderRightColor.R, borderRightColor.G, borderRightColor.B)).Replace("#", "") } }; } else { colorRightBorder = new Color(); } rightBorder.Append(colorRightBorder); _border.Append(rightBorder); TopBorder topBorder = new TopBorder() { Style = borderTopStyleValue }; Color colorTopBorder = null; if (borderTopColor != null) { colorTopBorder = new Color() { Rgb = new HexBinaryValue { Value = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(borderTopColor.R, borderTopColor.G, borderTopColor.B)).Replace("#", "") } }; } else { colorTopBorder = new Color(); } topBorder.Append(colorTopBorder); _border.Append(topBorder); BottomBorder bottomBorder = new BottomBorder() { Style = borderBottomStyleValue }; Color colorBottomBorder = null; if (borderBottomColor != null) { colorBottomBorder = new Color() { Rgb = new HexBinaryValue { Value = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(borderBottomColor.R, borderBottomColor.G, borderBottomColor.B)).Replace("#", "") } }; } else { colorBottomBorder = new Color(); } bottomBorder.Append(colorBottomBorder); _border.Append(bottomBorder); _oBorder = _border; Alignment _alignment = new Alignment(); _alignment.Horizontal = alignmentHorizontal; _alignment.Vertical = alignmentVertical; _oAlignment = _alignment; _oAlignment.WrapText = wrapText; _oAlignment.TextRotation.Value = textRotate; }
/// <summary> /// Set the diagonal border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetDiagonalBorder(BorderStyleValues BorderStyle, System.Drawing.Color BorderColor) { this.DiagonalBorder.BorderStyle = BorderStyle; this.DiagonalBorder.Color = BorderColor; }
public void SetBorder(string borderColor = "00000000", BorderStyleValues borderSize = BorderStyleValues.Thin, bool leftBorder = true, bool rightBorder = true, bool topBorder = true, bool bottomBorder = true) { BorderValue = CreateBorder(leftBorder, rightBorder, topBorder, bottomBorder, borderColor, borderSize); }
/// <summary> /// Creates the border for the cell /// </summary> /// <param name="templateSheetobj">Style sheet object of the template</param> /// <param name="borderStyle">Desired border style</param> /// <returns>Border Index</returns> private static UInt32Value CreateBorder(Stylesheet templateSheetobj, BorderStyleValues borderStyle) { Border border = new Border(); LeftBorder leftBorder = new LeftBorder(); RightBorder rightBorder = new RightBorder(); BottomBorder bottomBorder = new BottomBorder(); TopBorder topBorder = new TopBorder(); if (borderStyle == BorderStyleValues.Thin) { leftBorder.Style = BorderStyleValues.Thin; rightBorder.Style = BorderStyleValues.Thin; topBorder.Style = BorderStyleValues.Thin; bottomBorder.Style = BorderStyleValues.Thin; leftBorder.Append(new Color() { Indexed = (UInt32Value)64U }); rightBorder.Append(new Color() { Indexed = (UInt32Value)64U }); topBorder.Append(new Color() { Indexed = (UInt32Value)64U }); bottomBorder.Append(new Color() { Indexed = (UInt32Value)64U }); } else if (borderStyle == BorderStyleValues.Dotted) { leftBorder.Style = BorderStyleValues.Dotted; rightBorder.Style = BorderStyleValues.Dotted; topBorder.Style = BorderStyleValues.Dotted; bottomBorder.Style = BorderStyleValues.Dotted; leftBorder.Append(new Color() { Theme = 0, Tint = -0.499984740745262 }); rightBorder.Append(new Color() { Theme = 0, Tint = -0.499984740745262 }); topBorder.Append(new Color() { Theme = 0, Tint = -0.499984740745262 }); bottomBorder.Append(new Color() { Theme = 0, Tint = -0.499984740745262 }); } border.Append(leftBorder); border.Append(rightBorder); border.Append(topBorder); border.Append(bottomBorder); ////borders.Append(border); templateSheetobj.Borders.Append(border); UInt32Value result = templateSheetobj.Borders.Count; templateSheetobj.Borders.Count++; return(result); }
/// <summary> /// Set the top border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetTopBorder(BorderStyleValues BorderStyle, Color BorderColor) { TopBorder.BorderStyle = BorderStyle; TopBorder.Color = BorderColor; }
public BorderProperties(BorderStyleValues? borderStyle, UInt32Value color) { this.borderStyle = borderStyle; this.color = color; }
/// <summary> /// Set the right border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetRightBorder(BorderStyleValues BorderStyle, Color BorderColor) { RightBorder.BorderStyle = BorderStyle; RightBorder.Color = BorderColor; }
/// <summary> /// Set the right border with a border style and a theme color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> public void SetRightBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor) { RightBorder.BorderStyle = BorderStyle; RightBorder.SetBorderThemeColor(BorderColor); }
/// <summary> /// Set the left border with a border style and a theme color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> public void SetLeftBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor) { LeftBorder.BorderStyle = BorderStyle; LeftBorder.SetBorderThemeColor(BorderColor); }
/// <summary> /// Set the left border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetLeftBorder(BorderStyleValues BorderStyle, Color BorderColor) { LeftBorder.BorderStyle = BorderStyle; LeftBorder.Color = BorderColor; }
internal string GetBorderStyleAttribute(BorderStyleValues bsv) { var result = "none"; switch (bsv) { case BorderStyleValues.DashDot: result = "dashDot"; break; case BorderStyleValues.DashDotDot: result = "dashDotDot"; break; case BorderStyleValues.Dashed: result = "dashed"; break; case BorderStyleValues.Dotted: result = "dotted"; break; case BorderStyleValues.Double: result = "double"; break; case BorderStyleValues.Hair: result = "hair"; break; case BorderStyleValues.Medium: result = "medium"; break; case BorderStyleValues.MediumDashDot: result = "mediumDashDot"; break; case BorderStyleValues.MediumDashDotDot: result = "mediumDashDotDot"; break; case BorderStyleValues.MediumDashed: result = "mediumDashed"; break; case BorderStyleValues.None: result = "none"; break; case BorderStyleValues.SlantDashDot: result = "slantDashDot"; break; case BorderStyleValues.Thick: result = "thick"; break; case BorderStyleValues.Thin: result = "thin"; break; } return(result); }
/// <summary> /// Set the right border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetRightBorder(BorderStyleValues BorderStyle, System.Drawing.Color BorderColor) { this.Border.RightBorder.BorderStyle = BorderStyle; this.Border.RightBorder.Color = BorderColor; }
/// <summary> /// Set the top border with a border style and a theme color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> public void SetTopBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor) { TopBorder.BorderStyle = BorderStyle; TopBorder.SetBorderThemeColor(BorderColor); }
/// <summary> /// Set the vertical border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetVerticalBorder(BorderStyleValues BorderStyle, System.Drawing.Color BorderColor) { this.Border.VerticalBorder.BorderStyle = BorderStyle; this.Border.VerticalBorder.Color = BorderColor; }
/// <summary> /// Set the bottom border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetBottomBorder(BorderStyleValues BorderStyle, Color BorderColor) { BottomBorder.BorderStyle = BorderStyle; BottomBorder.Color = BorderColor; }
/// <summary> /// 获取只有普通Border的单元格格式索引 /// </summary> /// <param name="borderStyle"></param> /// <param name="dColor"></param> /// <returns></returns> protected uint GetBorderCellFormatIndex(BorderStyleValues borderStyle, DColor dColor) { var borderId = _openXMLExcel.GetBorderId(borderStyle, dColor); return(_openXMLExcel.GetCellFormatIndex(borderId)); }
/// <summary> /// Set the bottom border with a border style and a theme color, modifying the theme color with a tint value. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> /// <param name="Tint"> /// The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color /// and positive tints lighten the theme color. /// </param> public void SetBottomBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor, double Tint) { BottomBorder.BorderStyle = BorderStyle; BottomBorder.SetBorderThemeColor(BorderColor, Tint); }
private void AddOwnBorderStyle(WorkbookStylesPart stylesPart, IEnumerable <BorderPropertiesType> borderPropertiesTypes, BorderStyleValues borderStyle = BorderStyleValues.Thin) { var borderElements = stylesPart.Stylesheet.Borders.ChildElements.Where(x => x.ChildElements.Count == borderPropertiesTypes.Count()); foreach (var borderElement in borderElements) { bool existsAll = true; foreach (var item in borderPropertiesTypes) { if (!borderElement.ChildElements.Where(x => x.GetType() == item.GetType()).Any()) { existsAll = false; } } if (existsAll) { return; } } Border border = new Border(); foreach (var item in borderPropertiesTypes) { border.Append(item); } stylesPart.Stylesheet.Borders.Append(border); }
/// <summary> /// Set the diagonal border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetDiagonalBorder(BorderStyleValues BorderStyle, Color BorderColor) { DiagonalBorder.BorderStyle = BorderStyle; DiagonalBorder.Color = BorderColor; }
public void CreateStyle(string numberFormatCode, double fontSize, string fontName, string fontColor , bool fontBold, bool fontItalic, PatternValues fillPattern, string fillForeGroundColor, string borderLeftColor , BorderStyleValues borderLeftStyleValue, string borderBottomColor, BorderStyleValues borderBottomStyleValue, string borderRightColor , BorderStyleValues borderRightStyleValue, string borderTopColor, BorderStyleValues borderTopStyleValue, HorizontalAlignmentValues alignmentHorizontal, VerticalAlignmentValues alignmentVertical) { LCreateStyle(numberFormatCode, fontSize, fontName, fontColor , fontBold, fontItalic, fillPattern, fillForeGroundColor, borderLeftColor , borderLeftStyleValue, borderBottomColor, borderBottomStyleValue, borderRightColor , borderRightStyleValue, borderTopColor, borderTopStyleValue, alignmentHorizontal, alignmentVertical, textRotate); }
/// <summary> /// Set the diagonal border with a border style and a theme color, modifying the theme color with a tint value. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> /// <param name="Tint"> /// The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color /// and positive tints lighten the theme color. /// </param> public void SetDiagonalBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor, double Tint) { DiagonalBorder.BorderStyle = BorderStyle; DiagonalBorder.SetBorderThemeColor(BorderColor, Tint); }
internal string GetBorderStyleAttribute(BorderStyleValues bsv) { string result = "none"; switch (bsv) { case BorderStyleValues.DashDot: result = "dashDot"; break; case BorderStyleValues.DashDotDot: result = "dashDotDot"; break; case BorderStyleValues.Dashed: result = "dashed"; break; case BorderStyleValues.Dotted: result = "dotted"; break; case BorderStyleValues.Double: result = "double"; break; case BorderStyleValues.Hair: result = "hair"; break; case BorderStyleValues.Medium: result = "medium"; break; case BorderStyleValues.MediumDashDot: result = "mediumDashDot"; break; case BorderStyleValues.MediumDashDotDot: result = "mediumDashDotDot"; break; case BorderStyleValues.MediumDashed: result = "mediumDashed"; break; case BorderStyleValues.None: result = "none"; break; case BorderStyleValues.SlantDashDot: result = "slantDashDot"; break; case BorderStyleValues.Thick: result = "thick"; break; case BorderStyleValues.Thin: result = "thin"; break; } return result; }
/// <summary> /// Set the vertical border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetVerticalBorder(BorderStyleValues BorderStyle, Color BorderColor) { VerticalBorder.BorderStyle = BorderStyle; VerticalBorder.Color = BorderColor; }
/// <summary> /// Set the diagonal border with a border style and a theme color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> public void SetDiagonalBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor) { this.DiagonalBorder.BorderStyle = BorderStyle; this.DiagonalBorder.SetBorderThemeColor(BorderColor); }
/// <summary> /// Set the vertical border with a border style and a theme color, modifying the theme color with a tint value. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> /// <param name="Tint"> /// The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color /// and positive tints lighten the theme color. /// </param> public void SetVerticalBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor, double Tint) { VerticalBorder.BorderStyle = BorderStyle; VerticalBorder.SetBorderThemeColor(BorderColor, Tint); }
internal void FromBorderPropertiesType(HorizontalBorder border) { if (border.Color != null) { this.clrReal = new SLColor(this.listThemeColors, this.listIndexedColors); this.clrReal.FromSpreadsheetColor(border.Color); HasColor = !this.clrReal.IsEmpty(); } else { RemoveColor(); } if (border.Style != null) this.BorderStyle = border.Style.Value; else RemoveBorderStyle(); }
/// <summary> /// Set the horizontal border with a border style and a color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The border color.</param> public void SetHorizontalBorder(BorderStyleValues BorderStyle, Color BorderColor) { HorizontalBorder.BorderStyle = BorderStyle; HorizontalBorder.Color = BorderColor; }
/// <summary> /// Set the horizontal border with a border style and a theme color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> public void SetHorizontalBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor) { this.Border.HorizontalBorder.BorderStyle = BorderStyle; this.Border.HorizontalBorder.SetBorderThemeColor(BorderColor); }
/// <summary> /// Set the horizontal border with a border style and a theme color, modifying the theme color with a tint value. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> /// <param name="Tint"> /// The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color /// and positive tints lighten the theme color. /// </param> public void SetHorizontalBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor, double Tint) { HorizontalBorder.BorderStyle = BorderStyle; HorizontalBorder.SetBorderThemeColor(BorderColor, Tint); }
/// <summary> /// Set the top border with a border style and a theme color. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> public void SetTopBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor) { this.Border.TopBorder.BorderStyle = BorderStyle; this.Border.TopBorder.SetBorderThemeColor(BorderColor); }
/// <summary> /// Remove any existing border style. /// </summary> public void RemoveBorderStyle() { vBorderStyle = BorderStyleValues.None; HasBorderStyle = false; }
/// <summary> /// Set the vertical border with a border style and a theme color, modifying the theme color with a tint value. /// </summary> /// <param name="BorderStyle">The border style. Default is none.</param> /// <param name="BorderColor">The theme color to be used.</param> /// <param name="Tint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param> public void SetVerticalBorder(BorderStyleValues BorderStyle, SLThemeColorIndexValues BorderColor, double Tint) { this.Border.VerticalBorder.BorderStyle = BorderStyle; this.Border.VerticalBorder.SetBorderThemeColor(BorderColor, Tint); }
public static Border CreateBorder(bool leftBorder, bool rightBorder, bool topBorder, bool bottomBorder, string borderColor, BorderStyleValues borderSize) { Border border = new Border(); Color color = new Color { Rgb = HexBinaryValue.FromString(borderColor) }; if (leftBorder) { LeftBorder leftBorder2 = new LeftBorder() { Style = borderSize }; leftBorder2.Color = color; border.LeftBorder = leftBorder2; } if (rightBorder) { RightBorder rightBorder2 = new RightBorder() { Style = borderSize }; rightBorder2.Color = (Color)color.CloneNode(true); border.RightBorder = rightBorder2; } if (topBorder) { TopBorder topBorder2 = new TopBorder() { Style = borderSize }; topBorder2.Color = (Color)color.CloneNode(true); border.TopBorder = topBorder2; } if (bottomBorder) { BottomBorder bottomBorder2 = new BottomBorder() { Style = borderSize }; bottomBorder2.Color = (Color)color.CloneNode(true); border.BottomBorder = bottomBorder2; } return(border); }
public void RegisterBorder(string name, BorderStyleValues left = BorderStyleValues.None, BorderStyleValues top = BorderStyleValues.None, BorderStyleValues right = BorderStyleValues.None, BorderStyleValues bottom = BorderStyleValues.None) { RegisterBorder(name, new Border { LeftBorder = new LeftBorder { Style = left }, RightBorder = new RightBorder { Style = right }, TopBorder = new TopBorder { Style = top }, BottomBorder = new BottomBorder { Style = bottom }, DiagonalBorder = new DiagonalBorder() }); }
/// <summary> /// Генерация разных полных границ /// </summary> /// <returns></returns> /// <param name="left">Левая граница</param> /// <param name="right">Правая граница</param> /// <param name="top">Верхняя граница</param> /// <param name="bottom">Нижняя граница</param> public Border GenerateStandardFullBorderSetting(BorderStyleValues left, BorderStyleValues right, BorderStyleValues top, BorderStyleValues bottom) { Border border = new Border(); LeftBorder leftBorder = new LeftBorder() { Style = left }; Color color = new Color() { Indexed = (UInt32Value)64U }; leftBorder.Append(color); RightBorder rightBorder = new RightBorder() { Style = right }; Color color1 = new Color() { Indexed = (UInt32Value)64U }; rightBorder.Append(color1); TopBorder topBorder = new TopBorder() { Style = top }; Color color2 = new Color() { Indexed = (UInt32Value)64U }; topBorder.Append(color2); BottomBorder bottomBorder = new BottomBorder() { Style = bottom }; Color color3 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder.Append(color3); border.Append(leftBorder); border.Append(rightBorder); border.Append(topBorder); border.Append(bottomBorder); return(border); }