public void WriteTo(XmlWriter xmlWriter) { int c = 0; //BorderColor if (CBorder.Color.HasValue) { xmlWriter.WriteStartElement("BorderColor"); { xmlWriter.WriteElementString("Default", RdlcValueConverter.GetColorName(CBorder.Color.Value)); } xmlWriter.WriteEndElement(); } else { c++; } //BorderStyle if (CBorder.Style.HasValue) { xmlWriter.WriteStartElement("BorderStyle"); { xmlWriter.WriteElementString("Default", CBorder.Style.Value.ToString()); } xmlWriter.WriteEndElement(); } else { c++; } //BorderWidth if (CBorder.Width.HasValue) { xmlWriter.WriteStartElement("BorderWidth"); { xmlWriter.WriteElementString("Default", CBorder.Width.Value.ToString()); } xmlWriter.WriteEndElement(); } else { c++; } //if (c == 3) //{ // xmlWriter.WriteStartElement("BorderStyle"); // { // xmlWriter.WriteElementString("Default", BorderStyle.Dotted.ToString()); // } // xmlWriter.WriteEndElement(); //} }
public void WriteTo(XmlWriter xmlWriter) { Type StyleOwnerElementType = StyleOwnerElement.GetType(); if (CStyle == null) { return; } xmlWriter.WriteStartElement("Style"); { //Border if (CanApplyStyle(PROP_BORDER)) { RBorder rBorder = new RBorder(CStyle.Border); rBorder.WriteTo(xmlWriter); } //BackgroundColor if ((CStyle.BackgroundColor.HasValue) && (CanApplyStyle(PROP_BACKGROUND_COLOR))) { xmlWriter.WriteElementString("BackgroundColor", RdlcValueConverter.GetColorName(CStyle.BackgroundColor.Value)); } //BackgroundGradient if ((CStyle.BackgroundGradientType.HasValue) && (CStyle.BackgroundGradientEndColor.HasValue) && (CanApplyStyle(PROP_BACKGROUND_GRADIENT))) { xmlWriter.WriteElementString("BackgroundGradientType", CStyle.BackgroundGradientType.Value.ToString()); xmlWriter.WriteElementString("BackgroundGradientEndColor", RdlcValueConverter.GetColorName(CStyle.BackgroundGradientEndColor.Value)); } //BackgroundImage if ((CStyle.BackgroundImage != null) && (CanApplyStyle(PROP_BACKGROUND_IMAGE))) { xmlWriter.WriteStartElement("BackgroundImage"); { RBaseImage rBaseImage = new RBaseImage(CStyle.BackgroundImage.Image); rBaseImage.WriteTo(xmlWriter); if (CStyle.BackgroundImage.BackgroundRepeat.HasValue) { xmlWriter.WriteElementString("BackgroundRepeat", CStyle.BackgroundImage.BackgroundRepeat.Value.ToString()); } } xmlWriter.WriteEndElement(); } // Font if (CanApplyStyle(PROP_FONT)) { RFont rFont = new RFont(CStyle.Font); rFont.WriteTo(xmlWriter); } // Text properties if (CanApplyStyle(PROP_TEXT)) { if (!String.IsNullOrEmpty(CStyle.Format)) { xmlWriter.WriteElementString("Format", CStyle.Format); } if (CStyle.TextDecoration.HasValue) { xmlWriter.WriteElementString("TextDecoration", RConverter.ToString(CStyle.TextDecoration.Value)); } if (CStyle.TextAlign.HasValue) { xmlWriter.WriteElementString("TextAlign", RConverter.ToString(CStyle.TextAlign.Value)); } if (CStyle.VerticalAlign.HasValue) { xmlWriter.WriteElementString("VerticalAlign", RConverter.ToString(CStyle.VerticalAlign.Value)); } if (CStyle.Color.HasValue) { xmlWriter.WriteElementString("Color", RdlcValueConverter.GetColorName(CStyle.Color.Value)); } if (CStyle.LineHeight.HasValue) { xmlWriter.WriteElementString("LineHeight", CStyle.LineHeight.Value.ToString()); } if (CStyle.Direction.HasValue) { xmlWriter.WriteElementString("Direction", RConverter.ToString(CStyle.Direction.Value)); } if (CStyle.UnicodeBiDi.HasValue) { xmlWriter.WriteElementString("UnicodeBiDi", RConverter.ToString(CStyle.UnicodeBiDi.Value)); } } // Padding if (CanApplyStyle(PROP_PADDING)) { RRect rPadding = new RRect("Padding", "", CStyle.Padding); rPadding.WriteTo(xmlWriter); } // NUMERAL if (CanApplyStyle(PROP_NUMERAL)) { if (!String.IsNullOrEmpty(CStyle.NumeralLanguage)) { xmlWriter.WriteElementString("NumeralLanguage", CStyle.NumeralLanguage); } if (CStyle.NumeralVariant.HasValue) { xmlWriter.WriteElementString("NumeralVariant", CStyle.NumeralVariant.Value.ToString()); } } // CALENDAR if ((CStyle.Calendar.HasValue) && (CanApplyStyle(PROP_CALENDAR))) { xmlWriter.WriteElementString("Calendar", RConverter.ToString(CStyle.Calendar)); } // LANGUAGE if (!String.IsNullOrEmpty(CStyle.Language) && (CanApplyStyle(PROP_LANGUAGE))) { xmlWriter.WriteElementString("Language", RConverter.ToString(CStyle.Language)); } // WRITING MODE if ((CStyle.WritingMode.HasValue) && (CanApplyStyle(PROP_WRITING_MODE))) { xmlWriter.WriteElementString("WritingMode", RConverter.ToString(CStyle.WritingMode.Value)); } } xmlWriter.WriteEndElement(); }