示例#1
0
        private void InitExtendText()
        {
            if (this.designView.ExtendText == null || this.designView.ExtendText.Length == 0)
            {
                return;
            }
            ReportViewFacade facade    = new ReportViewFacade(this.DataProvider);
            string           strScript = "";

            for (int i = 0; i < this.designView.ExtendText.Length; i++)
            {
                string strId      = Convert.ToInt32(this.designView.ExtendText[i].Sequence).ToString();
                string styleValue = "";
                for (int n = 0; this.designView.DataFormats != null && n < this.designView.DataFormats.Length; n++)
                {
                    if (this.designView.DataFormats[n].FormatID == this.designView.ExtendText[i].FormatID)
                    {
                        styleValue = facade.BuildStyleValueFromDataFormat(this.designView.DataFormats[n]);
                        break;
                    }
                }
                if (styleValue != "")
                {
                    strScript += "AddReportTitleFromStyle('" + strId + "','" + styleValue.Replace("'", "\\'") + "');\r\n";
                }
            }
            if (strScript != "")
            {
                strScript += "lastReportTitleId=" + Convert.ToInt32(this.designView.ExtendText[this.designView.ExtendText.Length - 1].Sequence).ToString() + ";\r\n";
                //this.ClientScript.RegisterStartupScript(typeof(string), "add_report_title", "<script language=javascript>" + strScript + "</script>");
                ScriptManager.RegisterStartupScript(this, GetType(), "add_report_title", strScript, true);
            }
        }
示例#2
0
        private void ApplyDefinedStyle(decimal styleId)
        {
            ReportViewFacade facade = new ReportViewFacade(this.DataProvider);

            RptViewReportStyleDetail[] styleDtls = facade.GetRptViewReportStyleDetailByStyleID(styleId);
            if (styleDtls == null || styleDtls.Length == 0)
            {
                ClearExistStyle();
                return;
            }
            for (int i = 1; i < this.tbFormat.Rows.Count; i++)
            {
                for (int n = 0; n < this.tbFormat.Rows[i].Cells.Count; n++)
                {
                    HtmlInputHidden hidVal = this.GetFormatInputField(this.tbFormat.Rows[i].Cells[n]);
                    if (hidVal == null)
                    {
                        continue;
                    }
                    string strFormatType = hidVal.Attributes["FormatType"];
                    string strStyleType  = "";
                    if (strFormatType == "header" || strFormatType == "headerrow")
                    {
                        strStyleType = ReportStyleType.Header;
                    }
                    else if (strFormatType == "group")
                    {
                        strStyleType = ReportStyleType.SubTotal;
                    }
                    else if (strFormatType == "groupdata")
                    {
                        strStyleType = "";
                        for (int j = 0; this.designView.GridGroups != null && j < this.designView.GridGroups.Length; j++)
                        {
                            if (this.designView.GridGroups[j].ColumnName == hidVal.Attributes["ColumnName"])
                            {
                                strStyleType = ReportStyleType.SubTotalGroupField;
                                break;
                            }
                        }
                        if (strStyleType == "")
                        {
                            for (int j = 0; this.designView.GridGroupTotals != null && j < this.designView.GridGroupTotals.Length; j++)
                            {
                                if (this.designView.GridGroupTotals[j].GroupSequence == decimal.Parse(hidVal.Attributes["GroupSeq"]) &&
                                    this.designView.GridGroupTotals[j].ColumnName == hidVal.Attributes["ColumnName"])
                                {
                                    if (this.designView.GridGroupTotals[j].TotalType == ReportTotalType.Empty)
                                    {
                                        strStyleType = ReportStyleType.SubTotalNonCalField;
                                    }
                                    else
                                    {
                                        strStyleType = ReportStyleType.SubTotalCalField;
                                    }
                                }
                            }
                        }
                    }
                    else if (strFormatType == "itemdata" || strFormatType == "item")
                    {
                        strStyleType = ReportStyleType.Item;
                    }

                    hidVal.Value = "";
                    RptViewReportStyleDetail styleDtl = this.GetRptStyleDetailByType(styleDtls, strStyleType);
                    if (styleDtl != null)
                    {
                        RptViewDataFormat dataFormat = (RptViewDataFormat)facade.GetRptViewDataFormat(styleDtl.FormatID);
                        if (dataFormat != null)
                        {
                            hidVal.Value = facade.BuildStyleValueFromDataFormat(dataFormat);
                        }
                    }
                }
            }
        }