Exemple #1
0
        public void Apply()
        {
            XmlNode rNode = _Draw.GetReportNode();

            _Draw.SetElement(rNode, "Width", DesignerUtility.MakeValidSize(tbWidth.Text, false));
            _Draw.SetElement(rNode, "Author", tbReportAuthor.Text);
            _Draw.SetElement(rNode, "Description", tbReportDescription.Text);
            _Draw.SetElement(rNode, "PageWidth", tbPageWidth.Text);
            _Draw.SetElement(rNode, "PageHeight", tbPageHeight.Text);
            if (tbMarginLeft.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "LeftMargin", tbMarginLeft.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "LeftMargin");
            }
            if (tbMarginRight.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "RightMargin", tbMarginRight.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "RightMargin");
            }
            if (tbMarginBottom.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "BottomMargin", tbMarginBottom.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "BottomMargin");
            }
            if (tbMarginTop.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "TopMargin", tbMarginTop.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "TopMargin");
            }
            // Page header settings
            XmlNode phNode = _Draw.GetCreateNamedChildNode(rNode, "PageHeader");

            _Draw.SetElement(phNode, "PrintOnFirstPage", this.chkPHFirst.Checked?"true":"false");
            _Draw.SetElement(phNode, "PrintOnLastPage", this.chkPHLast.Checked?"true":"false");
            // Page footer settings
            XmlNode pfNode = _Draw.GetCreateNamedChildNode(rNode, "PageFooter");

            _Draw.SetElement(pfNode, "PrintOnFirstPage", this.chkPFFirst.Checked?"true":"false");
            _Draw.SetElement(pfNode, "PrintOnLastPage", this.chkPFLast.Checked?"true":"false");
        }
        public void ApplyChanges(XmlNode node)
        {
            if (tbName.Enabled && fName)
            {
                _Draw.SetName(node, tbName.Text.Trim());
            }

            if (fLeft)
            {
                _Draw.SetElement(node, "Left", DesignerUtility.MakeValidSize(tbLeft.Text, true));
            }

            if (fTop)
            {
                _Draw.SetElement(node, "Top", DesignerUtility.MakeValidSize(tbTop.Text, true));
            }

            bool bLine = node.Name == "Line";

            if (fWidth)
            {
                _Draw.SetElement(node, "Width", DesignerUtility.MakeValidSize(tbWidth.Text, bLine, bLine));
            }

            if (fHeight)
            {
                _Draw.SetElement(node, "Height", DesignerUtility.MakeValidSize(tbHeight.Text, bLine, bLine));
            }

            if (fZIndex)
            {
                _Draw.SetElement(node, "ZIndex", tbZIndex.Text);
            }

            if (fColSpan)
            {
                XmlNode ris   = node.ParentNode;
                XmlNode tcell = ris.ParentNode;
                if (tcell.Name == "TableCell")
                {                       // SetTableCellColSpan does all the heavy lifting;
                                        //    ie making sure the # of columns continue to match
                    _Draw.SetTableCellColSpan(tcell, tbColSpan.Value.ToString());
                }
            }

            if (fDataElementStyle)
            {
                _Draw.SetElement(node, "DataElementStyle", this.cbDataElementStyle.Text);
            }
            if (fHideDuplicates)
            {
                _Draw.SetElement(node, "HideDuplicates", this.cbHideDuplicates.Text);
            }
            if (fCanGrow)
            {
                _Draw.SetElement(node, "CanGrow", this.chkCanGrow.Checked? "true": "false");
            }
            if (fCanShrink)
            {
                _Draw.SetElement(node, "CanShrink", this.chkCanShrink.Checked? "true": "false");
            }
            if (fDataElementStyle)
            {
                _Draw.SetElement(node, "DataElementStyle", this.cbDataElementStyle.Text);
            }
            if (fToggleImage)
            {
                if (cbToggleImage.Text.Length <= 0)
                {
                    _Draw.RemoveElement(node, "ToggleImage");
                }
                else
                {
                    XmlNode ti = _Draw.SetElement(node, "ToggleImage", null);
                    _Draw.SetElement(ti, "InitialState", cbToggleImage.Text);
                }
            }
        }