Ejemplo n.º 1
0
        private void ApplyStyleByName(ReportComponentBase component, string styleName)
        {
            foreach (Style subStyle in Report.Styles)
            {
                if (subStyle.Name == styleName)
                {
                    Font f = new Font("Arial", 10, FontStyle.Regular);
                    if (component is TextObject)
                    {
                        f = (component as TextObject).Font;
                    }

                    component.Style = styleName;
                    component.ApplyStyle(subStyle);

                    string descr = GetObjectDescription(component.Name);

                    string useFont = GetPropertyValue("UseFont", descr);

                    if (useFont != string.Empty)
                    {
                        if (!UnitsConverter.ConvertBool(useFont))
                        {
                            (component as TextObject).Font = f;
                        }
                    }

                    return;
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadCheckBox(XmlNode node, Base parent)
        {
            CheckBoxObject checkBox = ComponentsFactory.CreateCheckBoxObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, checkBox);
            LoadSize(node, checkBox);
            LoadBorder(node, checkBox.Border);
            checkBox.Checked = UnitsConverter.ConvertBool(GetAttribute(node, "Checked"));
        }
Ejemplo n.º 3
0
        private void LoadPicture(string name, Base parent)
        {
            string        description = GetObjectDescription(name);
            PictureObject picture     = ComponentsFactory.CreatePictureObject(name, parent);

            LoadComponent(description, picture);
            LoadSize(description, picture);
            picture.SizeMode = UnitsConverter.ConvertImageSizeMode(GetPropertyValue("Sizing", description));
            picture.Style    = GetPropertyValue("StyleName", description).Replace("\"", "");
        }
Ejemplo n.º 4
0
        private void LoadPicture(XmlNode node, Base parent)
        {
            PictureObject picture = ComponentsFactory.CreatePictureObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, picture);
            LoadSize(node, picture);
            picture.SizeMode   = UnitsConverter.ConvertImageSizeMode(GetAttribute(node, "Sizing"));
            picture.ImageAlign = UnitsConverter.ConvertImageAlignment(GetAttribute(node, "ImageAlignment"));
            ApplyStyle(node, picture);
        }
Ejemplo n.º 5
0
        private void LoadSize(XmlNode node, ComponentBase comp)
        {
            string size = GetAttribute(node, "SizeF");

            if (!String.IsNullOrEmpty(size))
            {
                string[] sizes = size.Split(',');
                comp.Width  = UnitsConverter.SizeFToPixels(sizes[0]);
                comp.Height = UnitsConverter.SizeFToPixels(sizes[1]);
            }
        }
Ejemplo n.º 6
0
        private void LoadPanel(XmlNode node, Base parent)
        {
            ContainerObject panel = ComponentsFactory.CreateContainerObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, panel);
            LoadSize(node, panel);
            LoadBorder(node, panel.Border);
            panel.FillColor = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
            LoadObjects(node, panel);
        }
Ejemplo n.º 7
0
        private void LoadZipCode(XmlNode node, Base parent)
        {
            ZipCodeObject zipCode = ComponentsFactory.CreateZipCodeObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, zipCode);
            LoadSize(node, zipCode);
            zipCode.FillColor    = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
            zipCode.Border.Color = UnitsConverter.ConvertColor(GetAttribute(node, "ForeColor"));
            zipCode.Text         = GetAttribute(node, "Text").Replace("\"", "");
            ApplyStyle(node, zipCode);
        }
Ejemplo n.º 8
0
        private void LoadComponent(XmlNode node, ComponentBase comp)
        {
            comp.Name = GetAttribute(node, "Name");
            string location = GetAttribute(node, "LocationFloat");

            if (!string.IsNullOrEmpty(location))
            {
                string[] points = location.Split(',');
                comp.Left = UnitsConverter.SizeFToPixels(points[0]);
                comp.Top  = UnitsConverter.SizeFToPixels(points[1]);
            }
        }
Ejemplo n.º 9
0
 private void LoadBand(XmlNode node, BandBase band)
 {
     if (AttributeExist(node, "HeightF"))
     {
         band.Height = UnitsConverter.SizeFToPixels(GetAttribute(node, "HeightF"));
     }
     else
     {
         band.Height = 100;
     }
     band.FillColor = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
 }
Ejemplo n.º 10
0
 private void LoadBand(BandBase band, string description)
 {
     if (ExistValue("HeightF", description))
     {
         band.Height = UnitsConverter.SizeFToPixels(GetPropertyValue("HeightF", description));
     }
     else
     {
         band.Height = UnitsConverter.SizeFToPixels("100F");
     }
     band.FillColor = UnitsConverter.ConvertBackColor(GetPropertyValue("BackColor", description));
 }
Ejemplo n.º 11
0
        private void LoadBarCode(string name, Base parent)
        {
            string        description = GetObjectDescription(name);
            BarcodeObject barcode     = ComponentsFactory.CreateBarcodeObject(name, parent);

            LoadComponent(description, barcode);
            LoadSize(description, barcode);
            LoadBorder(description, barcode.Border);
            barcode.FillColor = UnitsConverter.ConvertBackColor(GetPropertyValue("BackColor", description));
            UnitsConverter.ConvertBarcodeSymbology(GetPropertyValue("Symbology", description), barcode);
            barcode.Style = GetPropertyValue("StyleName", description).Replace("\"", "");
        }
Ejemplo n.º 12
0
        private void LoadZipCode(string name, Base parent)
        {
            string        description = GetObjectDescription(name);
            ZipCodeObject zipCode     = ComponentsFactory.CreateZipCodeObject(name, parent);

            LoadComponent(description, zipCode);
            LoadSize(description, zipCode);
            zipCode.FillColor    = UnitsConverter.ConvertBackColor(GetPropertyValue("BackColor", description));
            zipCode.Border.Color = UnitsConverter.ConvertColor(GetPropertyValue("ForeColor", description));
            zipCode.Text         = GetPropertyValue("Text", description).Replace("\"", "");
            zipCode.Style        = GetPropertyValue("StyleName", description).Replace("\"", "");
        }
Ejemplo n.º 13
0
        private void LoadTableCell(string name, TableCell cell)
        {
            string description = GetObjectDescription(name);

            cell.Name      = name;
            cell.FillColor = UnitsConverter.ConvertBackColor(GetPropertyValue("BackColor", description));
            cell.TextColor = UnitsConverter.ConvertColor(GetPropertyValue("ForeColor", description));
            cell.Text      = GetPropertyValue("Text", description).Replace("\"", "");
            cell.HorzAlign = UnitsConverter.ConvertTextAlignmentToHorzAlign(GetPropertyValue("TextAlignment", description));
            cell.VertAlign = UnitsConverter.ConvertTextAlignmentToVertAlign(GetPropertyValue("TextAlignment", description));
            cell.Font      = LoadFont(description);
            ApplyStyleByName(cell, GetPropertyValue("StyleName", description).Replace("\"", ""));
        }
Ejemplo n.º 14
0
        private void LoadSize(string description, ComponentBase comp)
        {
            string size = GetPropertyValue("SizeF", description);

            if (!String.IsNullOrEmpty(size))
            {
                int start = size.IndexOf("(");
                int comma = size.IndexOf(",", start);
                int end   = size.IndexOf(")");
                comp.Width  = UnitsConverter.SizeFToPixels(size.Substring(start + 1, comma - start));
                comp.Height = UnitsConverter.SizeFToPixels(size.Substring(comma + 2, end - comma - 1));
            }
        }
Ejemplo n.º 15
0
        private void LoadBorder(XmlNode node, Border border)
        {
            string sides = GetAttribute(node, "Sides");

            if (string.IsNullOrEmpty(sides))
            {
                sides = GetAttribute(node, "Borders");
            }
            border.Lines = UnitsConverter.ConvertBorderSides(sides, border);
            border.Color = UnitsConverter.ConvertColor(GetAttribute(node, "BorderColor"));
            border.Width = UnitsConverter.SizeFToPixels(GetAttribute(node, "BorderWidthSerializable"));
            border.Style = UnitsConverter.ConvertBorderDashStyle(GetAttribute(node, "BorderDashStyle"));
        }
Ejemplo n.º 16
0
 private void LoadTableCell(XmlNode node, TableCell cell)
 {
     AddLocalizationItemsAttributes(node);
     cell.Name      = GetAttribute(node, "Name");
     cell.Text      = GetAttribute(node, "Text");
     cell.FillColor = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
     cell.TextColor = UnitsConverter.ConvertColor(GetAttribute(node, "ForeColor"));
     cell.HorzAlign = UnitsConverter.ConvertTextAlignmentToHorzAlign(GetAttribute(node, "TextAlignment"));
     cell.VertAlign = UnitsConverter.ConvertTextAlignmentToVertAlign(GetAttribute(node, "TextAlignment"));
     cell.Font      = LoadFontXml(GetAttribute(node, "Font"));
     ApplyStyle(node, cell);
     LoadObjects(node, cell);
 }
Ejemplo n.º 17
0
        private void LoadPageSize()
        {
            string height = GetPropertyValue("PageHeight", devText);
            string width  = GetPropertyValue("PageWidth", devText);

            if (!String.IsNullOrEmpty(height))
            {
                page.PaperHeight = UnitsConverter.SizeFToPixels(height) / Units.Millimeters;
            }
            if (!String.IsNullOrEmpty(width))
            {
                page.PaperWidth = UnitsConverter.SizeFToPixels(width) / Units.Millimeters;
            }
        }
Ejemplo n.º 18
0
        private void LoadComponent(string description, ComponentBase comp)
        {
            comp.Name = GetPropertyValue("Name", description).Replace("\"", "");
            string location = GetPropertyValue("LocationFloat", description);

            if (!String.IsNullOrEmpty(location))
            {
                int start = location.IndexOf("(");
                int comma = location.IndexOf(",", start);
                int end   = location.IndexOf(")");
                comp.Left = UnitsConverter.SizeFToPixels(location.Substring(start + 1, comma - start));
                comp.Top  = UnitsConverter.SizeFToPixels(location.Substring(comma + 2, end - comma - 1));
            }
        }
Ejemplo n.º 19
0
        private void LoadPageSizeXml()
        {
            string height = GetAttribute(reportNode, "PageHeight");
            string width  = GetAttribute(reportNode, "PageWidth");

            if (!String.IsNullOrEmpty(height))
            {
                page.PaperHeight = UnitsConverter.SizeFToPixels(height) / FastReport.Utils.Units.Millimeters;
            }
            if (!String.IsNullOrEmpty(width))
            {
                page.PaperWidth = UnitsConverter.SizeFToPixels(width) / FastReport.Utils.Units.Millimeters;
            }
        }
Ejemplo n.º 20
0
        private void LoadStyles()
        {
            List <string> names = GetStyleNames();

            foreach (string name in names)
            {
                Style  style       = ComponentsFactory.CreateStyle(name, Report);
                string description = GetObjectDescription(name);
                LoadBorder(description, style.Border);
                style.TextFill = new SolidFill(UnitsConverter.ConvertColor(GetPropertyValue("ForeColor", description)));
                style.Fill     = new SolidFill(UnitsConverter.ConvertBackColor(GetPropertyValue("BackColor", description)));
                style.Font     = LoadFont(description);
            }
        }
Ejemplo n.º 21
0
        private void LoadCellural(XmlNode node, Base parent)
        {
            CellularTextObject cellular = ComponentsFactory.CreateCellularTextObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, cellular);
            LoadSize(node, cellular);
            LoadBorder(node, cellular.Border);
            if (GetAttribute(node, "Borders").Equals(string.Empty))
            {
                cellular.Border.Lines = BorderLines.All;
            }
            cellular.FillColor = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
            cellular.Text      = GetAttribute(node, "Text");
        }
Ejemplo n.º 22
0
        private void LoadLabel(XmlNode node, Base parent)
        {
            TextObject text = ComponentsFactory.CreateTextObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, text);
            LoadSize(node, text);
            LoadBorder(node, text.Border);
            text.Font      = LoadFontXml(GetAttribute(node, "Font"));
            text.Text      = GetAttribute(node, "Text");
            text.FillColor = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
            text.TextColor = UnitsConverter.ConvertColor(GetAttribute(node, "ForeColor"));
            text.HorzAlign = UnitsConverter.ConvertTextAlignmentToHorzAlign(GetAttribute(node, "TextAlignment"));
            text.VertAlign = UnitsConverter.ConvertTextAlignmentToVertAlign(GetAttribute(node, "TextAlignment"));
            ApplyStyle(node, text);
        }
Ejemplo n.º 23
0
        private void LoadLine(string name, Base parent)
        {
            string     description = GetObjectDescription(name);
            LineObject line        = ComponentsFactory.CreateLineObject(name, parent);

            LoadComponent(description, line);
            LoadSize(description, line);
            line.Border.Color = UnitsConverter.ConvertColor(GetPropertyValue("ForeColor", description));
            line.Border.Style = UnitsConverter.ConvertLineStyle(GetPropertyValue("LineStyle", description));
            string width = GetPropertyValue("LineWidth", description);

            if (!String.IsNullOrEmpty(width))
            {
                line.Border.Width = Convert.ToSingle(width);
            }
            line.Style = GetPropertyValue("StyleName", description).Replace("\"", "");
        }
Ejemplo n.º 24
0
        private void LoadBarcode(XmlNode node, Base parent)
        {
            BarcodeObject barcode = ComponentsFactory.CreateBarcodeObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            barcode.AutoSize = false;
            LoadComponent(node, barcode);
            LoadSize(node, barcode);
            LoadBorder(node, barcode.Border);
            barcode.FillColor = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
            string symbology = GetAttribute(FindChildNoteByName(node, "symbology"), "Name");

            UnitsConverter.ConvertBarcodeSymbology(symbology, barcode);
            barcode.Text = GetAttribute(node, "Text");
            ApplyStyle(node, barcode);
            barcode.ShowText = !AttributeExist(node, "ShowText");
        }
Ejemplo n.º 25
0
        private void LoadLabel(string name, Base parent)
        {
            string     description = GetObjectDescription(name);
            TextObject text        = ComponentsFactory.CreateTextObject(name, parent);

            LoadComponent(description, text);
            LoadSize(description, text);
            LoadBorder(description, text.Border);
            text.Name      = name;
            text.FillColor = UnitsConverter.ConvertBackColor(GetPropertyValue("BackColor", description));
            text.TextColor = UnitsConverter.ConvertColor(GetPropertyValue("ForeColor", description));
            text.Text      = GetPropertyValue("Text", description).Replace("\"", "");
            text.HorzAlign = UnitsConverter.ConvertTextAlignmentToHorzAlign(GetPropertyValue("TextAlignment", description));
            text.VertAlign = UnitsConverter.ConvertTextAlignmentToVertAlign(GetPropertyValue("TextAlignment", description));
            text.Font      = LoadFont(description);
            ApplyStyleByName(text, GetPropertyValue("StyleName", description).Replace("\"", ""));
        }
Ejemplo n.º 26
0
        private void LoadShape(XmlNode node, Base parent)
        {
            ShapeObject shape = ComponentsFactory.CreateShapeObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, shape);
            LoadSize(node, shape);
            shape.Border.Color = UnitsConverter.ConvertColor(GetAttribute(node, "ForeColor"));
            shape.FillColor    = UnitsConverter.ConvertBackColor(GetAttribute(node, "BackColor"));
            shape.Shape        = UnitsConverter.ConvertShape(GetAttribute(node, "Shape"));
            string width = GetAttribute(node, "Width");

            if (!String.IsNullOrEmpty(width))
            {
                shape.Border.Width = Convert.ToSingle(width);
            }
            ApplyStyle(node, shape);
        }
Ejemplo n.º 27
0
        private void LoadShape(string name, Base parent)
        {
            string      description = GetObjectDescription(name);
            ShapeObject shape       = ComponentsFactory.CreateShapeObject(name, parent);

            LoadComponent(description, shape);
            LoadSize(description, shape);
            shape.Border.Color = UnitsConverter.ConvertColor(GetPropertyValue("ForeColor", description));
            shape.FillColor    = UnitsConverter.ConvertBackColor(GetPropertyValue("FillColor", description));
            shape.Shape        = UnitsConverter.ConvertShape(GetPropertyValue("Shape", description));
            string width = GetPropertyValue("LineWidth", description);

            if (!String.IsNullOrEmpty(width))
            {
                shape.Border.Width = Convert.ToSingle(width);
            }
            shape.Style = GetPropertyValue("StyleName", description).Replace("\"", "");
        }
Ejemplo n.º 28
0
        private void ApplyStyle(XmlNode node, ReportComponentBase component)
        {
            string  stylename     = GetAttribute(node, "StyleName");
            XmlNode stylePriority = FindChildNoteByName(node, "StylePriority");
            //if (stylePriority == null)
            //    return;
            XmlNode styleNode = GetStyleNode(stylename);

            foreach (Style style in Report.Styles)
            {
                if (style.Name == stylename)
                {
                    if (stylePriority == null || !AttributeExist(stylePriority, "UseFont"))
                    {
                        if (component as TextObject != null)
                        {
                            (component as TextObject).Font = style.Font;
                        }
                    }

                    if (stylePriority == null || !AttributeExist(stylePriority, "UseTextAlignment"))
                    {
                        if (component as TextObject != null)
                        {
                            (component as TextObject).HorzAlign = UnitsConverter.ConvertTextAlignmentToHorzAlign(GetAttribute(styleNode, "TextAlignment"));
                            (component as TextObject).VertAlign = UnitsConverter.ConvertTextAlignmentToVertAlign(GetAttribute(styleNode, "TextAlignment"));
                        }
                    }

                    if (stylePriority == null || !AttributeExist(stylePriority, "UseBorder"))
                    {
                        component.Border = style.Border;
                    }

                    if (stylePriority == null || !AttributeExist(stylePriority, "UseForeColor"))
                    {
                        if (component as TextObject != null)
                        {
                            (component as TextObject).TextColor = (style.TextFill as SolidFill).Color;
                        }
                    }
                }
            }
        }
Ejemplo n.º 29
0
        private void LoadBorder(string description, Border border)
        {
            string borders = GetPropertyValue("Borders", description);

            if (!String.IsNullOrEmpty(borders))
            {
                if (borders.IndexOf("Left") > -1)
                {
                    border.Lines |= BorderLines.Left;
                }
                if (borders.IndexOf("Top") > -1)
                {
                    border.Lines |= BorderLines.Top;
                }
                if (borders.IndexOf("Right") > -1)
                {
                    border.Lines |= BorderLines.Right;
                }
                if (borders.IndexOf("Bottom") > -1)
                {
                    border.Lines |= BorderLines.Bottom;
                }
            }
            string color = GetPropertyValue("BorderColor", description);

            if (!String.IsNullOrEmpty(color))
            {
                border.Color = UnitsConverter.ConvertColor(color);
            }
            string style = GetPropertyValue("BorderDashStyle", description);

            if (!String.IsNullOrEmpty(style))
            {
                border.Style = UnitsConverter.ConvertBorderDashStyle(style);
            }
            string width = GetPropertyValue("BorderWidth", description);

            if (!String.IsNullOrEmpty(width))
            {
                border.Width = UnitsConverter.SizeFToPixels(width);
            }
        }
Ejemplo n.º 30
0
        private Font LoadFont(string description)
        {
            string font = GetPropertyValue("Font", description);

            if (!String.IsNullOrEmpty(font))
            {
                int    start       = font.IndexOf("(");
                int    comma       = font.IndexOf(",", start);
                int    secondComma = font.IndexOf(",", comma + 1);
                string fontFamily  = font.Substring(start + 2, comma - start - 3);
                float  fontSize    = 10.0f;
                if (secondComma > -1)
                {
                    string str = font.Substring(comma + 2, secondComma - comma - 2);
                    fontSize = UnitsConverter.SizeFToPixelsFont(font.Substring(comma + 2, secondComma - comma - 2));
                    FontStyle fontStyle = FontStyle.Regular;
                    if (font.Contains("Bold"))
                    {
                        fontStyle |= FontStyle.Bold;
                    }
                    if (font.Contains("Italic"))
                    {
                        fontStyle |= FontStyle.Italic;
                    }
                    if (font.Contains("Underline"))
                    {
                        fontStyle |= FontStyle.Underline;
                    }
                    if (font.Contains("Strikeout"))
                    {
                        fontStyle |= FontStyle.Strikeout;
                    }
                    return(new Font(fontFamily, fontSize, fontStyle));
                }
                else
                {
                    string str = font.Substring(comma + 2, font.IndexOf(")") - comma - 2);
                    fontSize = UnitsConverter.SizeFToPixelsFont(font.Substring(comma + 2, font.IndexOf(")") - comma - 2));
                }
            }
            return(new Font("Arial", 10.0f, FontStyle.Regular));
        }