Exemplo n.º 1
0
        private void SetWithList(XmlNode n, string v, params string[] names)
        {
            foreach (string nm in names)
            {
                n = _Draw.GetCreateNamedChildNode(n, nm);
            }

            n.InnerText = v;
        }
Exemplo n.º 2
0
        private void ApplyDefaultValues(XmlNode repNode, ReportParm repParm)
        {
            _Draw.RemoveElement(repNode, "DefaultValue");
            if (repParm.Default)
            {
                if (repParm.DefaultValue == null || repParm.DefaultValue.Count == 0)
                {
                    return;
                }

                XmlNode defNode = _Draw.GetCreateNamedChildNode(repNode, "DefaultValue");
                XmlNode vNodes  = _Draw.GetCreateNamedChildNode(defNode, "Values");
                foreach (string dv in repParm.DefaultValue)
                {
                    _Draw.CreateElement(vNodes, "Value", dv);
                }
            }
            else
            {
                if (repParm.DefaultDSRDataSetName == null || repParm.DefaultDSRDataSetName.Length == 0 ||
                    repParm.DefaultDSRValueField == null || repParm.DefaultDSRValueField.Length == 0)
                {
                    return;
                }
                XmlNode defNode = _Draw.GetCreateNamedChildNode(repNode, "DefaultValue");
                XmlNode dsrNode = _Draw.GetCreateNamedChildNode(defNode, "DataSetReference");
                _Draw.CreateElement(dsrNode, "DataSetName", repParm.DefaultDSRDataSetName);
                _Draw.CreateElement(dsrNode, "ValueField", repParm.DefaultDSRValueField);
            }
        }
Exemplo n.º 3
0
        public void Apply()
        {
            // Remove the old row
            XmlNode rows = _Draw.GetNamedChildNode(this._dsNode, "Rows");

            if (rows == null)
            {
                rows = _Draw.GetNamedChildNode(this._dsNode, "fyi:Rows");
            }
            if (rows != null)
            {
                _dsNode.RemoveChild(rows);
            }
            // different result if we just want the file
            if (this.chkRowsFile.Checked)
            {
                rows = _Draw.GetCreateNamedChildNode(_dsNode, "fyi:Rows");
                _Draw.SetElementAttribute(rows, "File", this.tbRowsFile.Text);
            }
            else
            {
                rows = GetXmlData();
                if (rows.HasChildNodes)
                {
                    _dsNode.AppendChild(rows);
                }
            }
        }
Exemplo n.º 4
0
        private void InitValues()
        {
            XmlNode rNode = _Draw.GetReportNode();

            tbWidth.Text             = _Draw.GetElementValue(rNode, "Width", "");
            tbReportAuthor.Text      = _Draw.GetElementValue(rNode, "Author", "");
            tbReportDescription.Text = _Draw.GetElementValue(rNode, "Description", "");
            tbPageWidth.Text         = _Draw.GetElementValue(rNode, "PageWidth", "8.5in");
            tbPageHeight.Text        = _Draw.GetElementValue(rNode, "PageHeight", "11in");
            tbMarginLeft.Text        = _Draw.GetElementValue(rNode, "LeftMargin", "");
            tbMarginRight.Text       = _Draw.GetElementValue(rNode, "RightMargin", "");
            tbMarginBottom.Text      = _Draw.GetElementValue(rNode, "BottomMargin", "");
            tbMarginTop.Text         = _Draw.GetElementValue(rNode, "TopMargin", "");
            // Page header settings
            XmlNode phNode = _Draw.GetCreateNamedChildNode(rNode, "PageHeader");

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

            this.chkPFFirst.Checked = _Draw.GetElementValue(pfNode, "PrintOnFirstPage", "true").ToLower() == "true"? true: false;
            this.chkPFLast.Checked  = _Draw.GetElementValue(pfNode, "PrintOnLastPage", "true").ToLower() == "true"? true: false;
        }
Exemplo n.º 5
0
        public void Apply()
        {
            _Draw.SetElement(_Subreport, "ReportName", this.tbReportFile.Text);
            if (this.tbNoRows.Text.Trim().Length == 0)
            {
                _Draw.RemoveElement(_Subreport, "NoRows");
            }
            else
            {
                _Draw.SetElement(_Subreport, "NoRows", tbNoRows.Text);
            }

            _Draw.SetElement(_Subreport, "MergeTransactions", this.chkMergeTrans.Checked? "true": "false");

            // Remove the old filters
            XmlNode parms = _Draw.GetCreateNamedChildNode(_Subreport, "Parameters");

            while (parms.FirstChild != null)
            {
                parms.RemoveChild(parms.FirstChild);
            }
            // Loop thru and add all the filters
            foreach (DataRow dr in _DataTable.Rows)
            {
                if (dr[0] == DBNull.Value || dr[1] == DBNull.Value)
                {
                    continue;
                }
                string name = (string)dr[0];
                string val  = (string)dr[1];
                if (name.Length <= 0 || val.Length <= 0)
                {
                    continue;
                }
                XmlNode pNode = _Draw.CreateElement(parms, "Parameter", null);
                _Draw.SetElementAttribute(pNode, "Name", name);
                _Draw.SetElement(pNode, "Value", val);
            }
            if (!parms.HasChildNodes)
            {
                _Subreport.RemoveChild(parms);
            }
        }
Exemplo n.º 6
0
        private void InitTextStyles()
        {
            cbColor.Items.AddRange(StaticLists.ColorList);
            cbFormat.Items.AddRange(StaticLists.FormatList);

            XmlNode sNode = _ReportItems[0];

            if (_names != null)
            {
                sNode = _Draw.FindCreateNextInHierarchy(sNode, _names);
            }

            sNode = _Draw.GetCreateNamedChildNode(sNode, "Style");

            string sFontStyle      = "Normal";
            string sFontFamily     = "Arial";
            string sFontWeight     = "Normal";
            string sFontSize       = "10pt";
            string sTextDecoration = "None";
            string sHorzAlign      = "General";
            string sVerticalAlign  = "Top";
            string sColor          = "Black";
            string sFormat         = "";
            string sDirection      = "LTR";
            string sWritingMode    = "lr-tb";

            foreach (XmlNode lNode in sNode)
            {
                if (lNode.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (lNode.Name)
                {
                case "FontStyle":
                    sFontStyle = lNode.InnerText;
                    break;

                case "FontFamily":
                    sFontFamily = lNode.InnerText;
                    break;

                case "FontWeight":
                    sFontWeight = lNode.InnerText;
                    break;

                case "FontSize":
                    sFontSize = lNode.InnerText;
                    break;

                case "TextDecoration":
                    sTextDecoration = lNode.InnerText;
                    break;

                case "TextAlign":
                    sHorzAlign = lNode.InnerText;
                    break;

                case "VerticalAlign":
                    sVerticalAlign = lNode.InnerText;
                    break;

                case "Color":
                    sColor = lNode.InnerText;
                    break;

                case "Format":
                    sFormat = lNode.InnerText;
                    break;

                case "Direction":
                    sDirection = lNode.InnerText;
                    break;

                case "WritingMode":
                    sWritingMode = lNode.InnerText;
                    break;
                }
            }

            // Population Font Family dropdown
            foreach (FontFamily ff in FontFamily.Families)
            {
                cbFontFamily.Items.Add(ff.Name);
            }

            this.cbFontStyle.Text      = sFontStyle;
            this.cbFontFamily.Text     = sFontFamily;
            this.cbFontWeight.Text     = sFontWeight;
            this.cbFontSize.Text       = sFontSize;
            this.cbTextDecoration.Text = sTextDecoration;
            this.cbHorzAlign.Text      = sHorzAlign;
            this.cbVerticalAlign.Text  = sVerticalAlign;
            this.cbColor.Text          = sColor;
            this.cbFormat.Text         = sFormat;
            this.cbDirection.Text      = sDirection;
            this.cbWritingMode.Text    = sWritingMode;

            fHorzAlign = fFormat = fDirection = fWritingMode = fTextDecoration =
                fColor = fVerticalAlign = fFontStyle = fFontWeight = fFontSize = fFontFamily = false;

            return;
        }
Exemplo n.º 7
0
        public void Apply()
        {
            if (!HasRows())                                       // No expressions in grouping; get rid of grouping
            {
                _Draw.RemoveElement(_GroupingParent, "Grouping"); // can't have a grouping
                return;
            }

            // Get the group
            XmlNode grouping = _Draw.GetCreateNamedChildNode(_GroupingParent, "Grouping");

            _Draw.SetGroupName(grouping, tbName.Text.Trim());

            // Handle the label
            if (_GroupingParent.Name == "DynamicSeries" ||
                _GroupingParent.Name == "DynamicCategories")
            {
                if (this.cbLabelExpr.Text.Length > 0)
                {
                    _Draw.SetElement(_GroupingParent, "Label", cbLabelExpr.Text);
                }
                else
                {
                    _Draw.RemoveElement(_GroupingParent, "Label");
                }
            }
            else
            {
                if (this.cbLabelExpr.Text.Length > 0)
                {
                    _Draw.SetElement(grouping, "Label", cbLabelExpr.Text);
                }
                else
                {
                    _Draw.RemoveElement(grouping, "Label");
                }

                _Draw.SetElement(grouping, "PageBreakAtStart", this.chkPBS.Checked? "true": "false");
                _Draw.SetElement(grouping, "PageBreakAtEnd", this.chkPBE.Checked? "true": "false");
                if (cbParentExpr.Text.Length > 0)
                {
                    _Draw.SetElement(grouping, "Parent", cbParentExpr.Text);
                }
                else
                {
                    _Draw.RemoveElement(grouping, "Parent");
                }
            }


            // Loop thru and add all the group expressions
            XmlNode grpExprs = _Draw.GetCreateNamedChildNode(grouping, "GroupExpressions");

            grpExprs.RemoveAll();
            string firstexpr = null;

            foreach (DataRow dr in _DataTable.Rows)
            {
                if (dr[0] == DBNull.Value)
                {
                    continue;
                }
                string ge = (string)dr[0];
                if (ge.Length <= 0)
                {
                    continue;
                }
                _Draw.CreateElement(grpExprs, "GroupExpression", ge);
                if (firstexpr == null)
                {
                    firstexpr = ge;
                }
            }
            if (!grpExprs.HasChildNodes)
            {                   // With no group expressions there are no groups
                grouping.RemoveChild(grpExprs);
                grouping.ParentNode.RemoveChild(grouping);
                grouping = null;
            }

            if (_GroupingParent.Name == "TableGroup" && grouping != null)
            {
                if (this.chkGrpHeader.Checked)
                {
                    XmlNode header = _Draw.GetCreateNamedChildNode(_GroupingParent, "Header");
                    _Draw.SetElement(header, "RepeatOnNewPage", chkRepeatHeader.Checked? "true": "false");
                    XmlNode tblRows = _Draw.GetCreateNamedChildNode(header, "TableRows");
                    if (!tblRows.HasChildNodes)
                    {                           // We need to create a row
                        _Draw.InsertTableRow(tblRows);
                    }
                }
                else
                {
                    _Draw.RemoveElement(_GroupingParent, "Header");
                }

                if (this.chkGrpFooter.Checked)
                {
                    XmlNode footer = _Draw.GetCreateNamedChildNode(_GroupingParent, "Footer");
                    _Draw.SetElement(footer, "RepeatOnNewPage", chkRepeatFooter.Checked? "true": "false");
                    XmlNode tblRows = _Draw.GetCreateNamedChildNode(footer, "TableRows");
                    if (!tblRows.HasChildNodes)
                    {                           // We need to create a row
                        _Draw.InsertTableRow(tblRows);
                    }
                }
                else
                {
                    _Draw.RemoveElement(_GroupingParent, "Footer");
                }
            }
            else if (_GroupingParent.Name == "DynamicColumns" ||
                     _GroupingParent.Name == "DynamicRows")
            {
                XmlNode ritems = _Draw.GetNamedChildNode(_GroupingParent, "ReportItems");
                if (ritems == null)
                {
                    ritems = _Draw.GetCreateNamedChildNode(_GroupingParent, "ReportItems");
                }
                XmlNode item = ritems.FirstChild;
                if (item == null)
                {
                    item = _Draw.GetCreateNamedChildNode(ritems, "Textbox");
                    XmlNode vnode = _Draw.GetCreateNamedChildNode(item, "Value");
                    vnode.InnerText = firstexpr == null? "": firstexpr;
                }
            }
        }
Exemplo n.º 8
0
        private void BuildGroupingTabs()
        {
            XmlNode aNode = _Nodes[0];

            if (aNode.Name == "DynamicSeries")
            {
                this.Text = "Series Grouping";
            }
            else if (aNode.Name == "DynamicCategories")
            {
                this.Text = "Category Grouping";
            }
            else
            {
                this.Text = "Grouping and Sorting";
            }

            GroupingCtl gc = new GroupingCtl(_Draw, aNode);

            AddTab("Grouping", gc);

            SortingCtl sc = new SortingCtl(_Draw, aNode);

            AddTab("Sorting", sc);

            // We have to create a grouping here but will need to kill it if no definition follows it
            XmlNode gNode = _Draw.GetCreateNamedChildNode(aNode, "Grouping");

            FiltersCtl fc = new FiltersCtl(_Draw, gNode);

            AddTab("Filters", fc);



            return;
        }
Exemplo n.º 9
0
        private void InitValues()
        {
            XmlNode rNode = _Draw.GetReportNode();

            tbWidth.Text = _Draw.GetElementValue(rNode, "Width", "");

            tbReportAuthor.Text      = _Draw.GetElementValue(rNode, "Author", "");
            tbReportDescription.Text = _Draw.GetElementValue(rNode, "Description", "");

            tbPageWidth.Text  = _Draw.GetElementValue(rNode, "PageWidth", "8.5in");
            tbPageHeight.Text = _Draw.GetElementValue(rNode, "PageHeight", "11in");

            tbMarginLeft.Text   = _Draw.GetElementValue(rNode, "LeftMargin", "");
            tbMarginRight.Text  = _Draw.GetElementValue(rNode, "RightMargin", "");
            tbMarginBottom.Text = _Draw.GetElementValue(rNode, "BottomMargin", "");
            tbMarginTop.Text    = _Draw.GetElementValue(rNode, "TopMargin", "");

            // Page header settings
            XmlNode phNode = _Draw.GetCreateNamedChildNode(rNode, "PageHeader");

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

            this.chkPFFirst.Checked = _Draw.GetElementValue(pfNode, "PrintOnFirstPage", "true").ToLower() == "true"? true: false;
            this.chkPFLast.Checked  = _Draw.GetElementValue(pfNode, "PrintOnLastPage", "true").ToLower() == "true"? true: false;

            string sW = _Draw.GetElementValue(rNode, "PageWidth", "8.5in");
            string sH = _Draw.GetElementValue(rNode, "PageHeight", "11in");

            int index = -1;
            int XY    = -1;

            for (int i = 0; i < CacheHelper.Instance.Pages.Length; i++)
            {
                PrintPage page = CacheHelper.Instance.Pages[i];

                if ((sW == page.WidthString) & (sH == page.HeightString))
                {
                    index = i;
                    XY    = 0;
                    break;
                }

                if ((sH == page.WidthString) & (sW == page.HeightString))
                {
                    index = i;
                    XY    = 1;
                    break;
                }
            }

            if (index > -1)
            {
                this.cbxPages.SelectedIndex = index;

                if (XY > -1)
                {
                    this.cbxXY.SelectedIndex = XY;
                    this.cbxXY.Enabled       = true;
                }
            }
            else
            {
                this.tbPageWidth.Text  = sW;
                this.tbPageHeight.Text = sH;

                this.cbxPages.SelectedIndex = CacheHelper.Instance.Pages.Length - 1;
                this.cbxXY.Enabled          = false;
            }
        }
        private void InitBorders(XmlNode node)
        {
            cbColorDefault.Items.AddRange(StaticLists.ColorList);
            cbColorLeft.Items.AddRange(StaticLists.ColorList);
            cbColorRight.Items.AddRange(StaticLists.ColorList);
            cbColorTop.Items.AddRange(StaticLists.ColorList);
            cbColorBottom.Items.AddRange(StaticLists.ColorList);

            if (_names != null)
            {
                node = _Draw.FindCreateNextInHierarchy(node, _names);
            }

            XmlNode sNode = _Draw.GetCreateNamedChildNode(node, "Style");

            // Handle BorderStyle
            XmlNode bsNode = _Draw.SetElement(sNode, "BorderStyle", null);

            cbStyleDefault.Text = _Draw.GetElementValue(bsNode, "Default", "None");
            cbStyleLeft.Text    = _Draw.GetElementValue(bsNode, "Left", cbStyleDefault.Text);
            cbStyleRight.Text   = _Draw.GetElementValue(bsNode, "Right", cbStyleDefault.Text);
            cbStyleTop.Text     = _Draw.GetElementValue(bsNode, "Top", cbStyleDefault.Text);
            cbStyleBottom.Text  = _Draw.GetElementValue(bsNode, "Bottom", cbStyleDefault.Text);

            // Handle BorderColor
            XmlNode bcNode = _Draw.SetElement(sNode, "BorderColor", null);

            cbColorDefault.Text = _Draw.GetElementValue(bcNode, "Default", "Black");
            cbColorLeft.Text    = _Draw.GetElementValue(bcNode, "Left", cbColorDefault.Text);
            cbColorRight.Text   = _Draw.GetElementValue(bcNode, "Right", cbColorDefault.Text);
            cbColorTop.Text     = _Draw.GetElementValue(bcNode, "Top", cbColorDefault.Text);
            cbColorBottom.Text  = _Draw.GetElementValue(bcNode, "Bottom", cbColorDefault.Text);

            // Handle BorderWidth
            XmlNode bwNode = _Draw.SetElement(sNode, "BorderWidth", null);

            tbWidthDefault.Text = _Draw.GetElementValue(bwNode, "Default", "1pt");
            tbWidthLeft.Text    = _Draw.GetElementValue(bwNode, "Left", tbWidthDefault.Text);
            tbWidthRight.Text   = _Draw.GetElementValue(bwNode, "Right", tbWidthDefault.Text);
            tbWidthTop.Text     = _Draw.GetElementValue(bwNode, "Top", tbWidthDefault.Text);
            tbWidthBottom.Text  = _Draw.GetElementValue(bwNode, "Bottom", tbWidthDefault.Text);

            if (node.Name == "Line")
            {
                cbColorLeft.Visible                                                                                 =
                    cbColorRight.Visible                                                                            =
                        cbColorTop.Visible                                                                          =
                            cbColorBottom.Visible                                                                   =
                                bColorLeft.Visible                                                                  =
                                    bColorRight.Visible                                                             =
                                        bColorTop.Visible                                                           =
                                            bColorBottom.Visible                                                    =
                                                cbStyleLeft.Visible                                                 =
                                                    cbStyleRight.Visible                                            =
                                                        cbStyleTop.Visible                                          =
                                                            cbStyleBottom.Visible                                   =
                                                                lLeft.Visible                                       =
                                                                    lRight.Visible                                  =
                                                                        lTop.Visible                                =
                                                                            lBottom.Visible                         =
                                                                                tbWidthLeft.Visible                 =
                                                                                    tbWidthRight.Visible            =
                                                                                        tbWidthTop.Visible          =
                                                                                            tbWidthBottom.Visible   =
                                                                                                bCR.Visible         = bCL.Visible = bCT.Visible = bCB.Visible =
                                                                                                    bSR.Visible     = bSL.Visible = bST.Visible = bSB.Visible =
                                                                                                        bWR.Visible = bWL.Visible = bWT.Visible = bWB.Visible =
                                                                                                            false;
            }
            fStyleDefault         = fStyleLeft = fStyleRight = fStyleTop = fStyleBottom =
                fColorDefault     = fColorLeft = fColorRight = fColorTop = fColorBottom =
                    fWidthDefault = fWidthLeft = fWidthRight = fWidthTop = fWidthBottom = false;
        }