public void SetBorder(BorderThickness leftBorderThickness, BorderThickness topBorderThickness, BorderThickness rightBorderThickness, BorderThickness bottomBorderThickness) { AssertNotDisposed(); Excel.Range _range = _GetRange(); var blackColor = ColorTranslator.ToOle(Color.Black); Excel.Borders _borders = _range.Borders; Excel.Border _leftBorder = _borders[Excel.XlBordersIndex.xlEdgeLeft]; Excel.Border _topBorder = _borders[Excel.XlBordersIndex.xlEdgeTop]; Excel.Border _rightBorder = _borders[Excel.XlBordersIndex.xlEdgeRight]; Excel.Border _bottomBorder = _borders[Excel.XlBordersIndex.xlEdgeBottom]; _leftBorder.LineStyle = leftBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _topBorder.LineStyle = topBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _rightBorder.LineStyle = rightBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _bottomBorder.LineStyle = bottomBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _leftBorder.Weight = EnumConvert.ConvertBorderThickness(leftBorderThickness); _leftBorder.Color = blackColor; _topBorder.Weight = EnumConvert.ConvertBorderThickness(topBorderThickness); _topBorder.Color = blackColor; _rightBorder.Weight = EnumConvert.ConvertBorderThickness(rightBorderThickness); _rightBorder.Color = blackColor; _bottomBorder.Weight = EnumConvert.ConvertBorderThickness(bottomBorderThickness); _bottomBorder.Color = blackColor; Marshal.ReleaseComObject(_bottomBorder); Marshal.ReleaseComObject(_rightBorder); Marshal.ReleaseComObject(_topBorder); Marshal.ReleaseComObject(_leftBorder); Marshal.ReleaseComObject(_borders); Marshal.ReleaseComObject(_range); }
public BorderCollection(BorderThickness leftBorderThickness, BorderThickness topBorderThickness, BorderThickness rightBorderThickness, BorderThickness bottomBorderThickness) { LeftBorderThickness = leftBorderThickness; TopBorderThickness = topBorderThickness; RightBorderThickness = rightBorderThickness; BottomBorderThickness = bottomBorderThickness; }
public BorderCollection(BorderThickness leftBorderThickness, BorderThickness topBorderThickness, BorderThickness rightBorderThickness, BorderThickness bottomBorderThickness) { LeftBorderThickness = leftBorderThickness; TopBorderThickness = topBorderThickness; RightBorderThickness = rightBorderThickness; BottomBorderThickness = bottomBorderThickness; }
protected override Size ArrangeOverride(Size arrangeBounds) { var size = base.ArrangeOverride(arrangeBounds); _outerGeometry.Rect = new Rect(size); _innerGeometry.Rect = new Rect(size).GetInflated(BorderThickness.Negate()); return(size); }
public static Excel.XlBorderWeight ConvertBorderThickness(BorderThickness thickness) { switch (thickness) { case BorderThickness.Thick: return Excel.XlBorderWeight.xlThick; case BorderThickness.Medium: return Excel.XlBorderWeight.xlMedium; default: return Excel.XlBorderWeight.xlThin; } }
public static void DrawHLine(this Page page, int x, int y, int width, BorderThickness thickness = BorderThickness.Single) { var lineChar = thickness == BorderThickness.Double ? '═' : '─'; for (int i = 0; i < width - 1; i++) { page.SetCell( x + i, y, lineChar ); } }
public static void DrawVLine(this Page page, int x, int y, int height, BorderThickness thickness = BorderThickness.Single) { var lineChar = thickness == BorderThickness.Double ? '║' : '│'; for (int i = 0; i < height - 1; i++) { page.SetCell( x, y + i, lineChar ); } }
public override void WriteXml(XmlWriter writer) { writer.WriteElementString("Color", _colorConverter.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FillColor)); writer.WriteElementString("CornerRadius", CornerRadius.ToString(CultureInfo.InvariantCulture)); if (BorderThickness != 0d) { writer.WriteStartElement("Border"); writer.WriteElementString("Thickness", BorderThickness.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Color", _colorConverter.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, BorderColor)); writer.WriteEndElement(); } base.WriteXml(writer); }
public static Excel.XlBorderWeight ConvertBorderThickness(BorderThickness thickness) { switch (thickness) { case BorderThickness.Thick: return(Excel.XlBorderWeight.xlThick); case BorderThickness.Medium: return(Excel.XlBorderWeight.xlMedium); default: return(Excel.XlBorderWeight.xlThin); } }
public override void WriteXml(XmlWriter writer) { TypeConverter bc = TypeDescriptor.GetConverter(typeof(bool)); writer.WriteElementString("Color", _colorConverter.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FillColor)); writer.WriteElementString("CornerRadius", CornerRadius.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Inverse_direction", bc.ConvertToInvariantString(Inverse_direction)); if (BorderThickness != 0d) { writer.WriteStartElement("Border"); writer.WriteElementString("Thickness", BorderThickness.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Color", _colorConverter.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, BorderColor)); writer.WriteEndElement(); } base.WriteXml(writer); }
public override void WriteXml(XmlWriter writer) { TypeConverter colorConverter = TypeDescriptor.GetConverter(typeof(Color)); writer.WriteElementString("Image", Image); writer.WriteElementString("Alignment", Alignment.ToString()); writer.WriteElementString("CornerRadius", CornerRadius.ToString(CultureInfo.InvariantCulture)); if (BorderThickness != 0d) { writer.WriteStartElement("Border"); writer.WriteElementString("Thickness", BorderThickness.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Color", colorConverter.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, BorderColor)); writer.WriteEndElement(); } // Save base after image so size is properly persisted. base.WriteXml(writer); }
/// <summary> /// Creates XML for a given style /// </summary> /// <returns>Style in XML format</returns> public string ToXML() { StringBuilder result = new StringBuilder(); result.Append("<TableStyle ID=\"" + ID + "\""); result.Append(Serialize.Brush(BorderBrush, " BorderBrush", false)); result.Append(" BorderThickness=\"" + BorderThickness.ToString() + "\""); result.Append(Serialize.Brush(CellBorderBrush, " CellBorderBrush", false)); result.Append(" CellBorderThickness=\"" + CellBorderThickness.ToString() + "\""); result.Append(" CellPadding=\"" + CellPadding.ToString(CultureInfo.InvariantCulture) + "\""); result.Append(">\r"); result.Append(Serialize.Brush(Background, "Background", true)); result.Append(Serialize.Brush(CellFill, "CellFill", true)); result.Append(Serialize.Brush(HeaderFill, "HeaderFill", true)); result.Append("</TableStyle>\r"); return(result.ToString()); }
public void ToXml(XmlWriter writer) { var provider = new NumberFormatInfo { NumberDecimalSeparator = GlobalProfile.DecimalSymbolStandard.ToString() }; var cultureInfo = new CultureInfo("") { NumberFormat = { NumberDecimalSeparator = GlobalProfile.DecimalSymbolStandard.ToString() } }; cultureInfo.TextInfo.ListSeparator = GlobalProfile.ArgumentsSeparatorStandard.ToString(); var colorConverter = TypeDescriptor.GetConverter(typeof(Color)); var symbolTypeEnumConverter = TypeDescriptor.GetConverter(typeof(SymbolTypeEnum)); writer.WriteAttributeString("symbolantialias", AntiAlias.ToString().ToLower()); writer.WriteAttributeString("symbolsize", SymbolSize.ToString(provider)); writer.WriteAttributeString("symboltype", symbolTypeEnumConverter.ConvertToString(SymbolType)); writer.WriteAttributeString("symbolborderthickness", BorderThickness.ToString(provider)); writer.WriteAttributeString("symbolbordercolor", colorConverter.ConvertToString(null, cultureInfo, BorderColor)); writer.WriteAttributeString("symbolfillcolor", colorConverter.ConvertToString(null, cultureInfo, FillColor)); }
/// <summary> /// Chart 설정 또는 변량에 대해 XML 속성으로 생성합니다. /// </summary> /// <param name="writer">xml writer</param> public override void GenerateXmlAttributes(XmlWriter writer) { base.GenerateXmlAttributes(writer); if (Draw.HasValue) { writer.WriteAttributeString("DrawAnchors", Draw.GetHashCode().ToString()); } if (Sides.HasValue) { writer.WriteAttributeString("AnchorSides", Sides.ToString()); } if (Radius.HasValue) { writer.WriteAttributeString("AnchorRadius", Radius.ToString()); } if (BorderColor.HasValue) { writer.WriteAttributeString("AnchorBorderColor", BorderColor.Value.ToHexString()); } if (BorderThickness.HasValue) { writer.WriteAttributeString("AnchorBorderThickness", BorderThickness.ToString()); } if (BgColor.HasValue) { writer.WriteAttributeString("AnchorBgColor", BgColor.Value.ToHexString()); } if (Alpha.HasValue) { writer.WriteAttributeString("AnchorAlpha", Alpha.ToString()); } if (BgAlpha.HasValue) { writer.WriteAttributeString("AnchorBgAlpha", BgAlpha.ToString()); } }
public void SetBorder(BorderThickness leftBorderThickness, BorderThickness topBorderThickness, BorderThickness rightBorderThickness, BorderThickness bottomBorderThickness) { AssertNotDisposed(); Excel.Range _range = _GetRange(); var blackColor = ColorTranslator.ToOle(Color.Black); Excel.Borders _borders = _range.Borders; Excel.Border _leftBorder = _borders[Excel.XlBordersIndex.xlEdgeLeft]; Excel.Border _topBorder = _borders[Excel.XlBordersIndex.xlEdgeTop]; Excel.Border _rightBorder = _borders[Excel.XlBordersIndex.xlEdgeRight]; Excel.Border _bottomBorder = _borders[Excel.XlBordersIndex.xlEdgeBottom]; _leftBorder.LineStyle = leftBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _topBorder.LineStyle = topBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _rightBorder.LineStyle = rightBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _bottomBorder.LineStyle = bottomBorderThickness == BorderThickness.None ? Excel.XlLineStyle.xlLineStyleNone : Excel.XlLineStyle.xlContinuous; _leftBorder.Weight = EnumConvert.ConvertBorderThickness(leftBorderThickness); _leftBorder.Color = blackColor; _topBorder.Weight = EnumConvert.ConvertBorderThickness(topBorderThickness); _topBorder.Color = blackColor; _rightBorder.Weight = EnumConvert.ConvertBorderThickness(rightBorderThickness); _rightBorder.Color = blackColor; _bottomBorder.Weight = EnumConvert.ConvertBorderThickness(bottomBorderThickness); _bottomBorder.Color = blackColor; Marshal.ReleaseComObject(_bottomBorder); Marshal.ReleaseComObject(_rightBorder); Marshal.ReleaseComObject(_topBorder); Marshal.ReleaseComObject(_leftBorder); Marshal.ReleaseComObject(_borders); Marshal.ReleaseComObject(_range); }
public virtual void WriteXml(System.Xml.XmlWriter writer) { //if (!string.IsNullOrWhiteSpace(Title)) // writer.WriteAttributeString("Title", Title); //if (IconSource != null) // writer.WriteAttributeString("IconSource", IconSource.ToString()); //if (IsSelected) // writer.WriteAttributeString("IsSelected", IsSelected.ToString()); //if (IsLastFocusedDocument) // writer.WriteAttributeString("IsLastFocusedDocument", IsLastFocusedDocument.ToString()); if (!string.IsNullOrWhiteSpace(ContentId)) { writer.WriteAttributeString("ContentId", ContentId); } if (Margin != 0) { writer.WriteAttributeString("Margin", Margin.ToString()); } if (BorderThickness != 0) { writer.WriteAttributeString("BorderThickness", BorderThickness.ToString()); } if (BorderColor != Colors.Transparent) { writer.WriteAttributeString("BorderColor", BorderColor.ToString()); } if (BackgroundColor != Colors.Transparent) { writer.WriteAttributeString("BackgroundColor", BackgroundColor.ToString()); } //if (ToolTip != null && ToolTip is string) // if (!string.IsNullOrWhiteSpace((string)ToolTip)) // writer.WriteAttributeString("ToolTip", (string)ToolTip); //if (FloatingLeft != 0.0) // writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture)); //if (FloatingTop != 0.0) // writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture)); //if (FloatingWidth != 0.0) // writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture)); //if (FloatingHeight != 0.0) // writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture)); //if (IsMaximized) // writer.WriteAttributeString("IsMaximized", IsMaximized.ToString()); //if (!CanClose) // writer.WriteAttributeString("CanClose", CanClose.ToString()); //if (!CanFloat) // writer.WriteAttributeString("CanFloat", CanFloat.ToString()); //if (LastActivationTimeStamp != null) // writer.WriteAttributeString("LastActivationTimeStamp", LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture)); //if (_previousContainer != null) //{ // var paneSerializable = _previousContainer as ILayoutPaneSerializable; // if (paneSerializable != null) // { // writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id); // writer.WriteAttributeString("PreviousContainerIndex", _previousContainerIndex.ToString()); // } //} }
public bool ShouldSerializeBorderThickness() => SerializeDefaults || !BorderThickness.Equals(ZPLForgeDefaults.Elements.Ellipse.BorderThickness);
public static void DrawBox(this Page page, int x, int y, int width, int height, BorderThickness thickness = BorderThickness.Single) { string corners = thickness == BorderThickness.Double ? "╔╗╚╝" : "┌┐└┘"; DrawHLine(page, x + 1, y, width - 1, thickness); DrawHLine(page, x + 1, y + height - 1, width - 1, thickness); DrawVLine(page, x, y + 1, height - 1, thickness); DrawVLine(page, x + width - 1, y + 1, height - 1, thickness); page.SetCell(x, y, corners[0]); page.SetCell(x + width - 1, y, corners[1]); page.SetCell(x, y + height - 1, corners[2]); page.SetCell(x + width - 1, y + height - 1, corners[3]); }