public void WriteTo(XmlWriter xmlWriter) { if (CFont.FontStyle.HasValue) { xmlWriter.WriteElementString("FontStyle", CFont.FontStyle.Value.ToString()); } if (!String.IsNullOrEmpty(CFont.FontFamily)) { xmlWriter.WriteElementString("FontFamily", CFont.FontFamily); } if (CFont.FontSize.HasValue) { xmlWriter.WriteElementString("FontSize", CFont.FontSize.Value.ToString()); } if (CFont.FontWeight.HasValue) { int fontWeight = (int)CFont.FontWeight.Value; string strFontWeight = (fontWeight > 0) ? fontWeight.ToString() : RConverter.ToString(CFont.FontWeight.Value); xmlWriter.WriteElementString("FontWeight", strFontWeight); } }
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(); }