示例#1
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);
                        }
                    }
                }
            }
        }