Пример #1
0
            public override void WriteTo(XmlWriter xmlWriter)
            {
                xmlWriter.WriteStartElement("Image");
                {
                    xmlWriter.WriteAttributeString("Name", Name);

                    if (!IsTableOrMatrixSubItem)
                    {
                        xmlWriter.WriteElementString("Top", Item.Top.ToString());
                        xmlWriter.WriteElementString("Width", Item.Width.ToString());
                    }

                    if (!IsTableOrMatrixSubItem)
                    {
                        xmlWriter.WriteElementString("Left", Item.Left.ToString());
                        xmlWriter.WriteElementString("Height", Item.Height.ToString());
                    }

                    if (ImageBox.Action != null)
                    {
                        RAction rAction = new RAction(ImageBox.Action);
                        rAction.WriteTo(xmlWriter);
                    }

                    //Style
                    //base.Write(xmlWriter);
                    RStyle rStyle = new RStyle(this, Item.Style);
                    rStyle.WriteTo(xmlWriter);

                    xmlWriter.WriteElementString("ZIndex", ZIndex.ToString());

                    RBaseImage rBaseImage = new RBaseImage(ImageBox.Image);
                    rBaseImage.WriteTo(xmlWriter);
                }
                xmlWriter.WriteEndElement();
            }
Пример #2
0
            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();
            }