Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
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.º 5
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.º 6
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.º 7
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.º 8
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.º 9
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.º 10
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.º 11
0
        private Font LoadFontXml(string fontString)
        {
            if (string.IsNullOrEmpty(fontString))
            {
                return(new Font("Arial", 10, FontStyle.Regular));
            }

            string[] fontParts = fontString.Split(',');

            string fontFamily = fontParts[0];
            float  fontSize   = UnitsConverter.SizeFToPixels(fontParts[1].Substring(0, fontParts[1].Length - 2));

            if (fontString.IndexOf("style=") != -1)
            {
                string    styles    = fontString.Substring(fontString.IndexOf("style=") + 6);
                FontStyle fontStyle = FontStyle.Regular;
                if (styles.Contains("Bold"))
                {
                    fontStyle |= FontStyle.Bold;
                }
                if (styles.Contains("Italic"))
                {
                    fontStyle |= FontStyle.Italic;
                }
                if (styles.Contains("Underline"))
                {
                    fontStyle |= FontStyle.Underline;
                }
                if (styles.Contains("Strikeout"))
                {
                    fontStyle |= FontStyle.Strikeout;
                }
                return(new Font(fontFamily, fontSize, fontStyle));
            }
            return(new Font(fontFamily, fontSize, FontStyle.Regular));
        }
Ejemplo n.º 12
0
        private void LoadTable(XmlNode node, Base parent)
        {
            TableObject table = ComponentsFactory.CreateTableObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, table);
            LoadSize(node, table);
            LoadBorder(node, table.Border);
            ApplyStyle(node, table);
            TableInfo tableInfo = new TableInfo();
            XmlNode   rowsNode  = FindChildNoteByName(node, "Rows");

            int columnsCount = 0;

            foreach (XmlNode row in rowsNode.ChildNodes)
            {
                XmlNode cells = FindChildNoteByName(row, "Cells");

                if (columnsCount < cells.ChildNodes.Count)
                {
                    columnsCount = cells.ChildNodes.Count;

                    foreach (XmlNode cell in cells.ChildNodes)
                    {
                        AddLocalizationItemsAttributes(cell);
                        tableInfo.Column.Add(UnitsConverter.SizeFToPixels(GetAttribute(cell, "Weight")));
                    }
                }
            }

            foreach (XmlNode row in rowsNode)
            {
                AddLocalizationItemsAttributes(row);
                tableInfo.Row.Add(UnitsConverter.SizeFToPixels(GetAttribute(row, "Weight")));
            }

            for (int i = 0; i < columnsCount; i++)
            {
                TableColumn column = new TableColumn();
                column.Width = GetRowColumnSize(tableInfo.Column, i, table.Width);
                table.Columns.Add(column);
                column.CreateUniqueName();
            }

            for (int i = 0; i < rowsNode.ChildNodes.Count; i++)
            {
                XmlNode rowNode = rowsNode.ChildNodes[i];

                TableRow row = new TableRow();
                row.Name   = GetAttribute(rowNode, "Name");
                row.Height = GetRowColumnSize(tableInfo.Row, i, table.Height);
                XmlNode cells = FindChildNoteByName(rowNode, "Cells");

                for (int j = 0; j < cells.ChildNodes.Count; j++)
                {
                    XmlNode   cellNode = cells.ChildNodes[j];
                    TableCell cell     = new TableCell();
                    LoadTableCell(cellNode, cell);
                    if (j == cells.ChildNodes.Count - 1 && cells.ChildNodes.Count < columnsCount)
                    {
                        cell.ColSpan = columnsCount - cells.ChildNodes.Count + 1;
                    }
                    row.AddChild(cell);
                }
                table.Rows.Add(row);
            }
        }