Esempio n. 1
0
        /// <summary>
        /// Builds the page definition element.
        /// _build template object
        ///20130606 :: mellorasinxelas to write footer in two modes.
        /// </summary>
        protected virtual void _buildPageDef()
        {
            // TODO it would be usefull to check xml document against xsd

            // build the header, loop, body, footer from xml!
            XmlElement elmRoot = XMLTemplate.DocumentElement;

            if (elmRoot.Name.ToUpper() != "PAGEDEF")
            {
                throw new ArgumentException("Element Root not pagedef! pls check ur xml file!");
            }
            _pageDef = new PageDef(elmRoot.Attributes);

            var orientation = CurrentOrientation;

            if (XmlHelper.GetAttributeValue("pageorientation", PageDefinition.PageDefAttrs, "landscape").ToUpper() == "LANDSCAPE")
            {
                orientation = Orientation.Landscape;
            }

            SetPageDefWidthHeight(orientation);
            //Console.WriteLine("PageDef widthHeight: " + pageDef.Width + ", " + pageDef.Height);

            XmlNodeList header_nodes = elmRoot.SelectNodes("//header");

            if (header_nodes.Count > 0)
            {
                PageDefinition.Header = _buildDynamicRowGroup(header_nodes[0]);
            }
            XmlNodeList loop_nodes = elmRoot.SelectNodes("//loop");

            if (loop_nodes.Count > 0)
            {
                PageDefinition.Loop = _buildRowGroup(loop_nodes[0]);
            }
            XmlNodeList body_nodes = elmRoot.SelectNodes("//body");

            if (body_nodes.Count > 0)
            {
                PageDefinition.Body = _buildRowGroup(body_nodes[0]);
            }
            XmlNodeList footer_nodes = elmRoot.SelectNodes("//footer");

            if (footer_nodes.Count > 0)
            {
                //20130606 :: jaimelopez --> special elemet for footer.
                PageDefinition.Footer = _buildDynamicRowGroup(footer_nodes[0], true);
                //---
            }
            //Console.WriteLine("call _buildPageDef in PDFTemplate");
        }
Esempio n. 2
0
        /// <summary>
        /// Builds the page definition element.
        /// _build template object
        ///20130606 :: mellorasinxelas to write footer in two modes.
        /// </summary>
        protected virtual void _buildPageDef()
        {
            // build the header, loop, body, footer from xml!
            XmlElement elmRoot = XMLTemplate.DocumentElement;
            if (elmRoot.Name.ToUpper() != "PAGEDEF")
            {
                throw new ArgumentException("Element Root not pagedef! pls check ur xml file!");
            }
            _pageDef = new PageDef(elmRoot.Attributes);

            SetPageDefWidthHeight();
            //Console.WriteLine("PageDef widthHeight: " + pageDef.Width + ", " + pageDef.Height);

            XmlNodeList header_nodes = elmRoot.SelectNodes("//header");
            if (header_nodes.Count > 0)
            {
                PageDefinition.Header = _buildRowGroup(header_nodes[0]);
            }
            XmlNodeList loop_nodes = elmRoot.SelectNodes("//loop");
            if (loop_nodes.Count > 0)
            {
                PageDefinition.Loop = _buildRowGroup(loop_nodes[0]);
            }
            XmlNodeList body_nodes = elmRoot.SelectNodes("//body");
            if (body_nodes.Count > 0)
            {
                PageDefinition.Body = _buildRowGroup(body_nodes[0]);
            }
            XmlNodeList footer_nodes = elmRoot.SelectNodes("//footer");
            if (footer_nodes.Count > 0)
            {
                //20130606 :: jaimelopez --> special elemet for footer.
                PageDefinition.Footer = _buildRowGroup(footer_nodes[0], true);
                //---
            }
            //Console.WriteLine("call _buildPageDef in PDFTemplate");
        }