Ejemplo n.º 1
0
        private void LoadBorderColor(XmlNode borderColorNode)
        {
            XmlNodeList nodeList = borderColorNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Default")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.Color = UnitsConverter.ConvertColor(node.InnerText);
                    }
                }
                else if (node.Name == "Top")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.TopLine.Color = UnitsConverter.ConvertColor(node.InnerText);
                    }
                }
                else if (node.Name == "Left")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.LeftLine.Color = UnitsConverter.ConvertColor(node.InnerText);
                    }
                }
                else if (node.Name == "Right")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.RightLine.Color = UnitsConverter.ConvertColor(node.InnerText);
                    }
                }
                else if (node.Name == "Bottom")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.BottomLine.Color = UnitsConverter.ConvertColor(node.InnerText);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadStyle(XmlNode styleNode)
        {
            FontStyle   fontStyle     = FontStyle.Regular;
            string      fontFamily    = "Arial";
            float       fontSize      = 10.0f;
            int         paddingTop    = 0;
            int         paddingLeft   = 2;
            int         paddingRight  = 2;
            int         paddingBottom = 0;
            XmlNodeList nodeList      = styleNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "BorderColor")
                {
                    LoadBorderColor(node);
                }
                else if (node.Name == "BorderStyle")
                {
                    LoadBorderStyle(node);
                }
                else if (node.Name == "BorderWidth")
                {
                    LoadBorderWidth(node);
                }
                else if (node.Name == "BackgroundColor")
                {
                    if (component is ShapeObject)
                    {
                        (component as ShapeObject).FillColor = UnitsConverter.ConvertColor(node.InnerText);
                    }
                    else if (component is TableObject)
                    {
                        (component as TableObject).FillColor = UnitsConverter.ConvertColor(node.InnerText);
                    }
                }
                else if (node.Name == "FontStyle")
                {
                    fontStyle = UnitsConverter.ConvertFontStyle(node.InnerText);
                }
                else if (node.Name == "FontFamily")
                {
                    fontFamily = node.InnerText;
                }
                else if (node.Name == "FontSize")
                {
                    fontSize = Convert.ToSingle(UnitsConverter.ConvertFontSize(node.InnerText));
                }
                else if (node.Name == "TextAlign")
                {
                    if (component is TextObject)
                    {
                        (component as TextObject).HorzAlign = UnitsConverter.ConvertTextAlign(node.InnerText);
                    }
                }
                else if (node.Name == "VerticalAlign")
                {
                    if (component is TextObject)
                    {
                        (component as TextObject).VertAlign = UnitsConverter.ConvertVerticalAlign(node.InnerText);
                    }
                }
                else if (node.Name == "WritingMode")
                {
                    if (component is TextObject)
                    {
                        (component as TextObject).Angle = UnitsConverter.ConvertWritingMode(node.InnerText);
                    }
                }
                else if (node.Name == "Color")
                {
                    if (component is TextObject)
                    {
                        (component as TextObject).TextColor = UnitsConverter.ConvertColor(node.InnerText);
                    }
                }
                else if (node.Name == "PaddingLeft")
                {
                    paddingLeft = UnitsConverter.SizeToInt(node.InnerText, SizeUnits.Point);
                }
                else if (node.Name == "PaddingRight")
                {
                    paddingRight = UnitsConverter.SizeToInt(node.InnerText, SizeUnits.Point);
                }
                else if (node.Name == "PaddingTop")
                {
                    paddingTop = UnitsConverter.SizeToInt(node.InnerText, SizeUnits.Point);
                }
                else if (node.Name == "PaddingBottom")
                {
                    paddingBottom = UnitsConverter.SizeToInt(node.InnerText, SizeUnits.Point);
                }
            }
            if (component is TextObject)
            {
                (component as TextObject).Font    = new Font(fontFamily, fontSize, fontStyle);
                (component as TextObject).Padding = new Padding(paddingLeft, paddingTop, paddingRight, paddingBottom);
            }
            else if (component is PictureObject)
            {
                (component as PictureObject).Padding = new Padding(paddingLeft, paddingTop, paddingRight, paddingBottom);
            }
        }