Ejemplo n.º 1
0
        private void LoadImage(XmlNode imageNode)
        {
            component = ComponentsFactory.CreatePictureObject(imageNode.Attributes["Name"].Value, parent);
            XmlNodeList nodeList = imageNode.ChildNodes;

            LoadReportItem(nodeList);
            string name = String.Empty;

            foreach (XmlNode node in nodeList)
            {
                //if (node.Name == "Source")
                //{
                //}
                /*else */ if (node.Name == "Value")
                {
                    if (File.Exists(node.InnerText))
                    {
                        (component as PictureObject).ImageLocation = node.InnerText;
                    }
                }
                else if (node.Name == "Sizing")
                {
                    (component as PictureObject).SizeMode = UnitsConverter.ConvertSizing(node.InnerText);
                }
            }
        }
Ejemplo n.º 2
0
 private void LoadReportItem(XmlNodeList nodeList)
 {
     foreach (XmlNode node in nodeList)
     {
         if (node.Name == "Top")
         {
             component.Top = UnitsConverter.SizeToPixels(node.InnerText);
         }
         else if (node.Name == "Left")
         {
             component.Left = UnitsConverter.SizeToPixels(node.InnerText);
         }
         else if (node.Name == "Height")
         {
             component.Height = UnitsConverter.SizeToPixels(node.InnerText);
         }
         else if (node.Name == "Width")
         {
             component.Width = UnitsConverter.SizeToPixels(node.InnerText);
         }
         else if (node.Name == "Visibility")
         {
             LoadVisibility(node);
         }
         else if (node.Name == "Style")
         {
             LoadStyle(node);
         }
     }
     if (parent is TableCell)
     {
         component.Width  = (parent as TableCell).Width;
         component.Height = (parent as TableCell).Height;
     }
 }
Ejemplo n.º 3
0
        private void LoadVisibility(XmlNode visibilityNode)
        {
            XmlNodeList nodeList = visibilityNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Hidden")
                {
                    component.Visible = !UnitsConverter.BooleanToBool(node.InnerText);
                }
            }
        }
Ejemplo n.º 4
0
        private float LoadMatrixColumn(XmlNode matrixColumnNode, MatrixHeaderDescriptor column)
        {
            float       columnWidth = 2.5f * Utils.Units.Centimeters;
            XmlNodeList nodeList    = matrixColumnNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Width")
                {
                    columnWidth = UnitsConverter.SizeToPixels(node.InnerText);
                }
            }
            return(columnWidth);
        }
Ejemplo n.º 5
0
        private void LoadBorderStyle(XmlNode borderStyleNode)
        {
            XmlNodeList nodeList = borderStyleNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Default")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.Lines = BorderLines.All;
                        (component as ReportComponentBase).Border.Style = UnitsConverter.ConvertBorderStyle(node.InnerText);
                    }
                }
                else if (node.Name == "Top")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.Lines        |= BorderLines.Top;
                        (component as ReportComponentBase).Border.TopLine.Style = UnitsConverter.ConvertBorderStyle(node.InnerText);
                    }
                }
                else if (node.Name == "Left")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.Lines         |= BorderLines.Left;
                        (component as ReportComponentBase).Border.LeftLine.Style = UnitsConverter.ConvertBorderStyle(node.InnerText);
                    }
                }
                else if (node.Name == "Right")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.Lines          |= BorderLines.Right;
                        (component as ReportComponentBase).Border.RightLine.Style = UnitsConverter.ConvertBorderStyle(node.InnerText);
                    }
                }
                else if (node.Name == "Bottom")
                {
                    if (component is ReportComponentBase)
                    {
                        (component as ReportComponentBase).Border.Lines           |= BorderLines.Bottom;
                        (component as ReportComponentBase).Border.BottomLine.Style = UnitsConverter.ConvertBorderStyle(node.InnerText);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void LoadTableColumn(XmlNode tableColumnNode, TableColumn column)
        {
            XmlNodeList nodeList = tableColumnNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Width")
                {
                    column.Width = UnitsConverter.SizeToPixels(node.InnerText);
                }
                else if (node.Name == "Visibility")
                {
                    LoadVisibility(node);
                }
            }
        }
Ejemplo n.º 7
0
        private float LoadMatrixRow(XmlNode matrixRowNode, MatrixHeaderDescriptor row)
        {
            float       rowHeight = 0.8f * Utils.Units.Centimeters;
            XmlNodeList nodeList  = matrixRowNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Height")
                {
                    rowHeight = UnitsConverter.SizeToPixels(node.InnerText);
                }
                else if (node.Name == "MatrixCells")
                {
                    LoadMatrixCells(node);
                }
            }
            return(rowHeight);
        }
Ejemplo n.º 8
0
        private void LoadBody(XmlNode bodyNode)
        {
            parent  = ComponentsFactory.CreateDataBand(page);
            curBand = (BandBase)parent;
            XmlNodeList nodeList = bodyNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "ReportItems")
                {
                    LoadReportItems(node);
                }
                else if (node.Name == "Height")
                {
                    (parent as DataBand).Height = UnitsConverter.SizeToPixels(node.InnerText);
                }
            }
        }
Ejemplo n.º 9
0
        private void LoadPage(XmlNode pageNode)
        {
            XmlNodeList nodeList = pageNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "PageHeader")
                {
                    LoadPageSection(node);
                }
                else if (node.Name == "PageFooter")
                {
                    LoadPageSection(node);
                }
                else if (node.Name == "PageHeight")
                {
                    page.PaperHeight = UnitsConverter.SizeToMillimeters(node.InnerText);
                }
                else if (node.Name == "PageWidth")
                {
                    page.PaperWidth = UnitsConverter.SizeToMillimeters(node.InnerText);
                }
                else if (node.Name == "LeftMargin")
                {
                    page.LeftMargin = UnitsConverter.SizeToMillimeters(node.InnerText);
                }
                else if (node.Name == "RightMargin")
                {
                    page.RightMargin = UnitsConverter.SizeToMillimeters(node.InnerText);
                }
                else if (node.Name == "TopMargin")
                {
                    page.TopMargin = UnitsConverter.SizeToMillimeters(node.InnerText);
                }
                else if (node.Name == "BottomMargin")
                {
                    page.BottomMargin = UnitsConverter.SizeToMillimeters(node.InnerText);
                }
                else if (node.Name == "Style")
                {
                    LoadStyle(node);
                }
            }
        }
Ejemplo n.º 10
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.º 11
0
        private void LoadTableRow(XmlNode tableRowNode, TableRow row)
        {
            XmlNodeList nodeList = tableRowNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "TableCells" || node.Name == "TablixCells")
                {
                    LoadTableCells(node);
                }
                else if (node.Name == "Height")
                {
                    row.Height = UnitsConverter.SizeToPixels(node.InnerText);
                }
                else if (node.Name == "Visibility")
                {
                    LoadVisibility(node);
                }
            }
        }
Ejemplo n.º 12
0
        private float LoadRowGrouping(XmlNode rowGroupingNode, List <XmlNode> dynamicRows, List <XmlNode> staticRows)
        {
            float       cornerWidth = 2.5f * Utils.Units.Centimeters;
            XmlNodeList nodeList    = rowGroupingNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Width")
                {
                    cornerWidth = UnitsConverter.SizeToPixels(node.InnerText);
                }
                else if (node.Name == "DynamicRows")
                {
                    LoadDynamicRows(node, dynamicRows);
                }
                else if (node.Name == "StaticRows")
                {
                    LoadStaticRows(node, staticRows);
                }
            }
            return(cornerWidth);
        }
Ejemplo n.º 13
0
        private float LoadColumnGrouping(XmlNode columnGroupingNode, List <XmlNode> dynamicColumns, List <XmlNode> staticColumns)
        {
            float       cornerHeight = 0.8f * Utils.Units.Centimeters;
            XmlNodeList nodeList     = columnGroupingNode.ChildNodes;

            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "Height")
                {
                    cornerHeight = UnitsConverter.SizeToPixels(node.InnerText);
                }
                else if (node.Name == "DynamicColumns")
                {
                    LoadDynamicColumns(node, dynamicColumns);
                }
                else if (node.Name == "StaticColumns")
                {
                    LoadStaticColumns(node, staticColumns);
                }
            }
            return(cornerHeight);
        }
Ejemplo n.º 14
0
        private void LoadTextbox(XmlNode textboxNode)
        {
            if (parent is TableCell)
            {
                component = (TableCell)parent;
            }
            else
            {
                component = ComponentsFactory.CreateTextObject(textboxNode.Attributes["Name"].Value, parent);
            }
            XmlNodeList nodeList = textboxNode.ChildNodes;

            LoadReportItem(nodeList);
            foreach (XmlNode node in nodeList)
            {
                if (node.Name == "CanGrow")
                {
                    (component as TextObject).CanGrow = UnitsConverter.BooleanToBool(node.InnerText);
                }
                else if (node.Name == "CanShrink")
                {
                    (component as TextObject).CanShrink = UnitsConverter.BooleanToBool(node.InnerText);
                }
                else if (node.Name == "HideDuplicates")
                {
                    (component as TextObject).Duplicates = Duplicates.Hide;
                }
                else if (node.Name == "Value")
                {
                    (component as TextObject).Text = node.InnerText;
                }
                else if (node.Name == "Paragraphs")
                {
                    LoadParagraphs(node);
                }
            }
        }
Ejemplo n.º 15
0
 private void LoadPageSection(XmlNode pageSectionNode)
 {
     if (pageSectionNode.Name == "PageHeader")
     {
         page.PageHeader = new PageHeaderBand();
         page.PageHeader.CreateUniqueName();
         page.PageHeader.PrintOn = PrintOn.EvenPages | PrintOn.OddPages | PrintOn.RepeatedBand;
         XmlNodeList nodeList = pageSectionNode.ChildNodes;
         foreach (XmlNode node in nodeList)
         {
             if (node.Name == "Height")
             {
                 page.PageHeader.Height = UnitsConverter.SizeToPixels(node.InnerText);
             }
             else if (node.Name == "PrintOnFirstPage")
             {
                 if (node.InnerText == "true")
                 {
                     page.PageHeader.PrintOn |= PrintOn.FirstPage;
                 }
             }
             else if (node.Name == "PrintOnLastPage")
             {
                 if (node.InnerText == "true")
                 {
                     page.PageHeader.PrintOn |= PrintOn.LastPage;
                 }
             }
             else if (node.Name == "ReportItems")
             {
                 parent = page.PageHeader;
                 LoadReportItems(node);
             }
         }
     }
     else if (pageSectionNode.Name == "PageFooter")
     {
         page.PageFooter = new PageFooterBand();
         page.PageFooter.CreateUniqueName();
         page.PageFooter.PrintOn = PrintOn.EvenPages | PrintOn.OddPages | PrintOn.RepeatedBand;
         XmlNodeList nodeList = pageSectionNode.ChildNodes;
         foreach (XmlNode node in nodeList)
         {
             if (node.Name == "Height")
             {
                 page.PageFooter.Height = UnitsConverter.SizeToPixels(node.InnerText);
             }
             else if (node.Name == "PrintOnFirstPage")
             {
                 if (node.InnerText == "true")
                 {
                     page.PageFooter.PrintOn |= PrintOn.FirstPage;
                 }
             }
             else if (node.Name == "PrintOnLastPage")
             {
                 if (node.InnerText == "true")
                 {
                     page.PageFooter.PrintOn |= PrintOn.LastPage;
                 }
             }
             else if (node.Name == "ReportItems")
             {
                 parent = page.PageFooter;
                 LoadReportItems(node);
             }
         }
     }
 }
Ejemplo n.º 16
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);
            }
        }