Esempio n. 1
0
        public override void Undo(object p_args)
        {
            SubTotalCmdArgs args   = (SubTotalCmdArgs)p_args;
            RptMtxLevel     pLevel = args.Parent as RptMtxLevel;
            RptMtxSubtotal  total  = args.SubTotal;
            RptMatrix       mtx    = pLevel.Matrix;

            total.TotalLoc = total.TotalLoc == TotalLocation.After ? TotalLocation.Before : TotalLocation.After;
            if (pLevel != null)
            {
                if (pLevel.Parent is RptMtxRowHeader)
                {
                    mtx.Rows.RemoveRange(args.CurIndex, args.OpsRows.Count);
                    mtx.Rows.InsertRange(args.BefIndex, args.OpsRows);
                }
                else
                {
                    foreach (RptMtxRow row in args.OpsCells.Keys)
                    {
                        row.Cells.RemoveRange(args.CurIndex, args.OpsCells[row].Count);
                        row.Cells.InsertRange(args.BefIndex, args.OpsCells[row]);
                    }
                }
            }
            mtx.Update(true);
        }
Esempio n. 2
0
 /// <summary>
 /// 读取子元素xml,结束时定位在该子元素的末尾元素上
 /// </summary>
 /// <param name="p_reader"></param>
 protected override void ReadChildXml(XmlReader p_reader)
 {
     if (p_reader.Name == "Level")
     {
         RptMtxLevel level = new RptMtxLevel(this);
         level.ReadXml(p_reader);
         _levels.Add(level);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 创建小计
 /// </summary>
 /// <param name="totals"></param>
 /// <param name="p_header"></param>
 /// <param name="p_matInst"></param>
 /// <param name="p_curRow"></param>
 /// <param name="p_data"></param>
 /// <param name="p_loc"></param>
 void CreateTotalInst(List <RptMtxSubtotal> totals, RptMtxHeader p_header, RptMatrixInst p_matInst, Row p_curRow, RptData p_data, TotalLocation p_loc)
 {
     foreach (RptMtxSubtotal total in totals)
     {
         if (total.TotalLoc == p_loc)
         {
             if (total.SubTotals.Count > 0)
             {
                 CreateTotalInst(total.SubTotals, p_header, p_matInst, p_curRow, p_data, p_loc);
             }
             else
             {
                 RptMtxHeaderInst totalInst = new RptMtxHeaderInst(p_header);
                 for (int j = 0; j < p_header.Levels.IndexOf(total.Level); j++)
                 {
                     RptMtxLevel nLevel = p_header.Levels[j];
                     nLevel.Item.ColSpan = 1;
                     nLevel.Item.RowSpan = 1;
                     RptTextInst txtlevel = new RptTextInst(nLevel.Item);
                     totalInst.TxtInsts.Add(txtlevel);
                     totalInst.Filter.Add(nLevel.Field, p_curRow.Str(nLevel.Field));
                 }
                 RptItemBase parent = total.Parent;
                 while (parent is RptMtxSubtotal)
                 {
                     RptTextInst parTotal = new RptTextInst((parent as RptMtxSubtotal).Item);
                     totalInst.TxtInsts.Add(parTotal);
                     parent = parent.Parent;
                 }
                 RptTextInst txtTotal = new RptTextInst(total.Item);
                 totalInst.TxtInsts.Add(txtTotal);
                 totalInst.RptData         = p_data;
                 totalInst.RptData.Current = p_curRow.Index;
                 totalInst.Index           = p_curRow.Index;
                 if (p_header is RptMtxColHeader)
                 {
                     totalInst.MtxRowsCol = total.Col;
                     p_matInst.AddColHeader(totalInst);
                 }
                 else
                 {
                     totalInst.MtxRowsRow = total.Row;
                     p_matInst.AddRowHeader(totalInst);
                 }
             }
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 获取子层所占行(列)数
        /// </summary>
        /// <param name="p_levels"></param>
        /// <returns></returns>
        int SubLevelSpan(List <RptMtxLevel> p_levels)
        {
            int span = 1;

            for (int i = p_levels.Count - 1; i >= 0; i--)
            {
                RptMtxLevel level   = p_levels[i];
                int         tiCount = GetTitleSpan(level.SubTitles);
                if (tiCount != 0)
                {
                    span += tiCount;
                }
                span += GetTotalSpan(level.SubTotals);  //小计与层同一级,有几行就占几行
            }
            return(span);
        }
Esempio n. 5
0
        /// <summary>
        /// 克隆层
        /// </summary>
        /// <param name="p_header"></param>
        /// <returns></returns>
        public RptMtxLevel Clone(RptMtxHeader p_header)
        {
            RptMtxLevel level = new RptMtxLevel(p_header);

            level.Data.Copy(this.Data);
            level.Item.Data.Copy(Item.Data);
            foreach (RptMtxSubtotal total in SubTotals)
            {
                level.SubTotals.Add(total.Clone(level));
            }
            foreach (RptMtxSubtitle title in SubTitles)
            {
                level.SubTitles.Add(title.Clone(level));
            }
            return(level);
        }
Esempio n. 6
0
        public override object Execute(object p_args)
        {
            InsertCmdArgs args = (InsertCmdArgs)p_args;
            RptMatrix     mat  = args.RptItem as RptMatrix;
            RptPart       con  = mat.Part;

            // 是通过重做来执行的,直接返回对象。
            if (mat.RowHeader != null || mat.ColHeader != null)
            {
                con.Items.Add(mat);
                return(mat);
            }

            CellRange range = args.CellRange;

            mat.Row     = range.Row;
            mat.Col     = range.Column;
            mat.RowSpan = range.RowCount;
            mat.ColSpan = range.ColumnCount;
            mat.Corner  = new RptMtxCorner(mat);
            RptMtxRowHeader rowheader = new RptMtxRowHeader(mat);

            mat.RowHeader = rowheader;
            RptMtxLevel level2 = new RptMtxLevel(rowheader);

            level2.Item.Val = "level2";
            rowheader.Levels.Add(level2);

            RptMtxColHeader colheader = new RptMtxColHeader(mat);

            mat.ColHeader = colheader;
            RptMtxLevel level1 = new RptMtxLevel(colheader);

            level1.Item.Val = "level1";
            colheader.Levels.Add(level1);

            RptMtxRow row = new RptMtxRow(mat);

            row.Cells.Add(new RptText(row)
            {
                Val = "cell0"
            });
            mat.Rows.Add(row);
            con.Items.Add(mat);
            return(mat);
        }
Esempio n. 7
0
 /// <summary>
 /// 创建标题
 /// </summary>
 /// <param name="p_titles"></param>
 /// <param name="p_header"></param>
 /// <param name="p_matInst"></param>
 /// <param name="p_curRow"></param>
 /// <param name="p_data"></param>
 void CreateSubTiltelInst(List <RptMtxSubtitle> p_titles, RptMtxHeader p_header, RptMatrixInst p_matInst, Row p_curRow, RptData p_data)
 {
     foreach (RptMtxSubtitle title in p_titles)
     {
         if (title.SubTitles.Count > 0)
         {
             CreateSubTiltelInst(title.SubTitles, p_header, p_matInst, p_curRow, p_data);
         }
         else
         {
             RptMtxHeaderInst titleInst = new RptMtxHeaderInst(p_header);
             for (int j = 0; j <= p_header.Levels.IndexOf(title.Level); j++)
             {
                 RptMtxLevel nLevel = p_header.Levels[j];
                 nLevel.Item.ColSpan = 1;
                 nLevel.Item.RowSpan = 1;
                 RptTextInst txtlevel = new RptTextInst(nLevel.Item);
                 titleInst.TxtInsts.Add(txtlevel);
                 titleInst.Filter.Add(nLevel.Field, p_curRow.Str(nLevel.Field));
             }
             RptItemBase parent = title.Parent;
             while (parent is RptMtxSubtotal)
             {
                 RptTextInst parTotal = new RptTextInst((parent as RptMtxSubtotal).Item);
                 titleInst.TxtInsts.Add(parTotal);
                 parent = parent.Parent;
             }
             RptTextInst txtTotal = new RptTextInst(title.Item);
             titleInst.TxtInsts.Add(txtTotal);
             titleInst.RptData         = p_data;
             titleInst.RptData.Current = p_curRow.Index;
             titleInst.Index           = p_curRow.Index;
             if (p_header is RptMtxColHeader)
             {
                 titleInst.MtxRowsCol = title.Col;
                 p_matInst.AddColHeader(titleInst);
             }
             else
             {
                 titleInst.MtxRowsRow = title.Row;
                 p_matInst.AddRowHeader(titleInst);
             }
         }
     }
 }
Esempio n. 8
0
        public override void Undo(object p_args)
        {
            SubTitleCmdArgs args   = (SubTitleCmdArgs)p_args;
            RptMtxSubtitle  title  = args.SubTitle;
            RptItemBase     parent = args.Parent;
            RptMatrix       mtx    = null;

            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                args.BackMtxRow();
                pLevel.SubTitles.Insert(args.TilteIndex, title);
            }
            else
            {
                RptMtxSubtitle pTotal = parent as RptMtxSubtitle;
                mtx = pTotal.Level.Matrix;
                args.BackMtxRow();
                pTotal.SubTitles.Insert(args.TilteIndex, title);
            }
            mtx.Update(true);
        }
Esempio n. 9
0
        public override void Undo(object p_args)
        {
            SubTitleCmdArgs args   = (SubTitleCmdArgs)p_args;
            RptMtxSubtitle  title  = args.SubTitle;
            RptItemBase     parent = args.Parent;
            RptMatrix       mtx    = null;

            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                args.DelMtxRows();
                pLevel.SubTitles.Remove(title);
            }
            else
            {
                RptMtxSubtitle pTitle = parent as RptMtxSubtitle;
                mtx = pTitle.Level.Matrix;
                args.DelMtxRows();
                pTitle.SubTitles.Remove(title);
            }
            mtx.Update(true);
        }
Esempio n. 10
0
        public override void Undo(object p_args)
        {
            SubTotalCmdArgs args   = (SubTotalCmdArgs)p_args;
            RptMtxSubtotal  total  = args.SubTotal;
            RptItemBase     parent = args.Parent;
            RptMatrix       mtx    = null;

            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                args.DelMtxRows();
                pLevel.SubTotals.Remove(total);
            }
            else
            {
                RptMtxSubtotal pTotal = parent as RptMtxSubtotal;
                mtx = pTotal.Level.Matrix;
                args.DelMtxRows();
                pTotal.SubTotals.Remove(total);
            }
            mtx.Update(true);
        }
Esempio n. 11
0
        public override object Execute(object p_args)
        {
            SubTitleCmdArgs  args       = (SubTitleCmdArgs)p_args;
            RptItemBase      parent     = args.Parent;
            RptMtxSubtitle   title      = args.SubTitle;
            RptMtxHeaderType headerType = RptMtxHeaderType.Col;
            RptMatrix        mtx        = null;

            args.InitData();
            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                if (pLevel.Parent is RptMtxRowHeader)
                {
                    headerType = RptMtxHeaderType.Row;
                }
                DelRows(args, headerType, mtx, title);
                args.TilteIndex = pLevel.SubTitles.IndexOf(title);
                pLevel.SubTitles.Remove(title);
            }
            else
            {
                RptMtxSubtitle pTotal = parent as RptMtxSubtitle;
                mtx = pTotal.Level.Matrix;
                if (pTotal.Level.Parent is RptMtxRowHeader)
                {
                    headerType = RptMtxHeaderType.Row;
                }
                DelRows(args, headerType, mtx, title);
                args.TilteIndex = pTotal.SubTitles.IndexOf(title);
                pTotal.SubTitles.Remove(title);
            }
            mtx.Update(true);
            return(null);
        }
Esempio n. 12
0
        public override object Execute(object p_args)
        {
            SubTitleCmdArgs  args       = (SubTitleCmdArgs)p_args;
            RptItemBase      parent     = args.Parent;
            RptMtxHeaderType headerType = RptMtxHeaderType.Col;
            RptMtxSubtitle   title      = args.SubTitle;
            RptMatrix        mtx        = null;

            if (title == null)
            {
                title = new RptMtxSubtitle(parent);
                args.InitData();
                if (parent is RptMtxLevel)
                {
                    RptMtxLevel pLevel = parent as RptMtxLevel;
                    mtx = pLevel.Matrix;
                    if (pLevel.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    title.Item.Val = string.Format("subtitle{0}", mtx.GetMaxTitle());

                    RptMtxHeader header = pLevel.Parent as RptMtxHeader;
                    if (pLevel.SubTitles.Count > 0 || header.Levels.Count > header.Levels.IndexOf(pLevel) + 1)
                    {
                        int curIndex = 0;
                        if (headerType == RptMtxHeaderType.Row)
                        {
                            int subLevelSpan = 0;
                            if (header.Levels.Count > header.Levels.IndexOf(pLevel) + 1)
                            {
                                subLevelSpan = header.Levels[header.Levels.IndexOf(pLevel) + 1].RowSpan;
                            }

                            curIndex = pLevel.Row - mtx.ColHeader.Row - mtx.ColHeader.RowSpan + subLevelSpan + pLevel.GetTitleSpan(pLevel.SubTitles);
                            args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                        }
                        else
                        {
                            int subLevelSpan = 0;
                            if (header.Levels.Count > header.Levels.IndexOf(pLevel) + 1)
                            {
                                subLevelSpan = header.Levels[header.Levels.IndexOf(pLevel) + 1].ColSpan;
                            }

                            curIndex = pLevel.Col - mtx.RowHeader.Col - mtx.RowHeader.ColSpan + subLevelSpan + pLevel.GetTitleSpan(pLevel.SubTitles);
                            foreach (RptMtxRow row in mtx.Rows)
                            {
                                args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                            }
                        }
                        args.CurIndex = curIndex;
                    }
                    pLevel.SubTitles.Add(title);
                }
                else
                {
                    RptMtxSubtitle pTitle = parent as RptMtxSubtitle;
                    mtx = pTitle.Level.Matrix;
                    if (pTitle.Level.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    title.Item.Val = string.Format("subtitle{0}", mtx.GetMaxTitle());
                    if (pTitle.SubTitles.Count > 0)
                    {
                        int curIndex = 0;
                        if (headerType == RptMtxHeaderType.Row)
                        {
                            curIndex = pTitle.Row + pTitle.RowSpan - mtx.ColHeader.Row - mtx.ColHeader.RowSpan;
                            args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                        }
                        else
                        {
                            curIndex = pTitle.Col + pTitle.ColSpan - mtx.RowHeader.Col - mtx.RowHeader.ColSpan;
                            foreach (RptMtxRow row in mtx.Rows)
                            {
                                args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                            }
                        }
                        args.CurIndex = curIndex;
                    }
                    pTitle.SubTitles.Add(title);
                }
                args.SubTitle = title;
            }
            else
            {
                mtx = title.Level.Matrix;
                if (parent is RptMtxLevel)
                {
                    args.BackMtxRow();
                    (parent as RptMtxLevel).SubTitles.Add(title);
                }
                else
                {
                    (parent as RptMtxSubtitle).SubTitles.Add(title);
                }
            }
            mtx.Update(true);
            return(title);
        }
Esempio n. 13
0
 internal void LoadItem(RptText p_item)
 {
     _level   = p_item.Parent as RptMtxLevel;
     _fv.Data = _level.Data;
     _fvMtx.LoadItem(_level.Parent.Parent as RptMatrix);
 }
Esempio n. 14
0
        public override object Execute(object p_args)
        {
            SubTotalCmdArgs  args       = (SubTotalCmdArgs)p_args;
            RptItemBase      parent     = args.Parent;
            RptMtxHeaderType headerType = RptMtxHeaderType.Col;
            RptMtxSubtotal   total      = args.SubTotal;
            RptMatrix        mtx        = null;

            if (total == null)
            {
                total = new RptMtxSubtotal(parent);
                args.InitData();
                if (parent is RptMtxLevel)
                {
                    RptMtxLevel pLevel = parent as RptMtxLevel;
                    mtx = pLevel.Matrix;
                    if (pLevel.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    total.Item.Val = string.Format("subtotal{0}", mtx.GetMaxTotal());
                    int curIndex = 0;
                    if (headerType == RptMtxHeaderType.Row)
                    {
                        curIndex = pLevel.Row;
                        if (!mtx.HideRowHeader && !mtx.HideColHeader)
                        {
                            curIndex -= (mtx.Corner.Row + mtx.Corner.RowSpan);
                        }
                        args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                    }
                    else
                    {
                        curIndex = pLevel.Col - mtx.Rows[0].Col;
                        foreach (RptMtxRow row in mtx.Rows)
                        {
                            args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                        }
                    }
                    args.CurIndex = curIndex;
                }
                else
                {
                    RptMtxSubtotal pTotal = parent as RptMtxSubtotal;
                    mtx = pTotal.Level.Matrix;
                    if (pTotal.Level.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    total.Item.Val = string.Format("subtotal{0}", mtx.GetMaxTotal());
                    if (pTotal.SubTotals.Count > 0)
                    {
                        int curIndex = 0;
                        if (headerType == RptMtxHeaderType.Row)
                        {
                            curIndex = pTotal.Row + pTotal.GetCount();
                            if (!mtx.HideColHeader && !mtx.HideRowHeader)
                            {
                                curIndex -= (mtx.Corner.Row + mtx.Corner.RowSpan);
                            }
                            args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                        }
                        else
                        {
                            curIndex = pTotal.Col - mtx.Rows[0].Col + pTotal.GetCount();
                            foreach (RptMtxRow row in mtx.Rows)
                            {
                                args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                            }
                        }
                        args.CurIndex = curIndex;
                    }
                }
            }
            else
            {
                mtx = total.Level.Matrix;
                args.BackMtxRow();
            }
            if (parent is RptMtxLevel)
            {
                (parent as RptMtxLevel).SubTotals.Add(total);
            }
            else
            {
                (parent as RptMtxSubtotal).SubTotals.Add(total);
            }
            args.SubTotal = total;
            mtx.Update(true);
            return(total);
        }
Esempio n. 15
0
        public override object Execute(object p_args)
        {
            SubTotalCmdArgs args   = (SubTotalCmdArgs)p_args;
            RptMtxLevel     pLevel = args.Parent as RptMtxLevel;
            RptMtxSubtotal  total  = args.SubTotal;
            RptMatrix       mtx    = pLevel.Matrix;

            if (pLevel != null)
            {
                int count    = 0;
                int newIndex = 0;
                int index    = 0;
                if (pLevel.Parent is RptMtxRowHeader)
                {
                    args.OpsRows = total.GetRptRows(out index);
                    mtx.Rows.RemoveRange(index, args.OpsRows.Count);
                    if (total.TotalLoc == TotalLocation.Before)
                    {
                        count = (from c in pLevel.SubTotals
                                 where c.TotalLoc == total.TotalLoc &&
                                 pLevel.SubTotals.IndexOf(c) >= pLevel.SubTotals.IndexOf(total)
                                 select c).Count();
                        newIndex = pLevel.Row - count - (mtx.Row + mtx.ColHeader.RowSpan);
                    }
                    else
                    {
                        count = (from c in pLevel.SubTotals
                                 where c.TotalLoc == total.TotalLoc &&
                                 pLevel.SubTotals.IndexOf(c) < pLevel.SubTotals.IndexOf(total)
                                 select c).Count();
                        newIndex = pLevel.Row + pLevel.RowSpan + count - (mtx.Row + mtx.ColHeader.RowSpan);
                    }
                    mtx.Rows.InsertRange(newIndex, args.OpsRows);
                }
                else
                {
                    args.OpsCells = total.GetRptCells(out index);
                    foreach (RptMtxRow row in args.OpsCells.Keys)
                    {
                        row.Cells.RemoveRange(index, args.OpsCells[row].Count);
                        if (total.TotalLoc == TotalLocation.Before)
                        {
                            count = (from c in pLevel.SubTotals
                                     where c.TotalLoc == total.TotalLoc &&
                                     pLevel.SubTotals.IndexOf(c) >= pLevel.SubTotals.IndexOf(total)
                                     select c).Count();
                            newIndex = pLevel.Col - count - (mtx.Col + mtx.RowHeader.ColSpan);
                        }
                        else
                        {
                            count = (from c in pLevel.SubTotals
                                     where c.TotalLoc == total.TotalLoc &&
                                     pLevel.SubTotals.IndexOf(c) < pLevel.SubTotals.IndexOf(total)
                                     select c).Count();
                            newIndex = pLevel.Col + pLevel.ColSpan + count - (mtx.Col + mtx.RowHeader.ColSpan);
                        }
                        row.Cells.InsertRange(newIndex, args.OpsCells[row]);
                    }
                }
                args.BefIndex = index;
                args.CurIndex = newIndex;
            }
            mtx.Update(true);
            return(null);
        }
Esempio n. 16
0
        /// <summary>
        /// 构造行头或列头
        /// </summary>
        /// <param name="p_rptData"></param>
        /// <param name="p_header"></param>
        /// <param name="p_matInst"></param>
        void BuildHeader(RptData p_rptData, RptMtxHeader p_header, RptMatrixInst p_matInst)
        {
            List <string> colNames      = p_header.GetFieldNames();
            List <Row>    allHeaderData = SelectDistinctDataRows(p_rptData.Data, colNames);
            Row           preRow        = null;

            for (int i = 0; i < allHeaderData.Count; i++)
            {
                Row curRow = allHeaderData[i];
                if (preRow == null || !string.IsNullOrEmpty(CompareTwoRows(preRow, curRow, colNames)))
                {
                    //前面小计
                    foreach (RptMtxLevel level in p_header.Levels)
                    {
                        if (level.SubTotals.Count <= 0)
                        {
                            continue;
                        }
                        RptMtxLevel beforLevel = null;
                        if (p_header.Levels.IndexOf(level) - 1 >= 0)
                        {
                            beforLevel = p_header.Levels[p_header.Levels.IndexOf(level) - 1];
                        }
                        //第一行(列) 或者 前一行(列)层值与当前行层值不同 创建小计
                        if (preRow == null || (beforLevel != null && preRow.Str(beforLevel.Field) != curRow.Str(beforLevel.Field)))
                        {
                            CreateTotalInst(level.SubTotals, p_header, p_matInst, curRow, p_rptData, TotalLocation.Before);
                        }
                    }

                    //数据
                    RptMtxHeaderInst headerInst = new RptMtxHeaderInst(p_header);
                    foreach (RptMtxLevel level in p_header.Levels)
                    {
                        if (level.SubTitles.Count > 0)
                        {
                            CreateSubTiltelInst(level.SubTitles, p_header, p_matInst, curRow, p_rptData);
                        }
                        else
                        {
                            //手动置1,因为输出头的时候按一行或一列输出,不需要控件合并
                            level.Item.ColSpan = 1;
                            level.Item.RowSpan = 1;
                            RptTextInst txtlevel = new RptTextInst(level.Item);
                            headerInst.TxtInsts.Add(txtlevel);
                        }
                    }
                    if (headerInst.TxtInsts.Count > 0)
                    {
                        headerInst.RptData = p_rptData;
                        headerInst.Index   = curRow.Index;
                        if (p_header is RptMtxColHeader)
                        {
                            headerInst.MtxRowsCol = p_header.Levels[p_header.Levels.Count - 1].Col;
                            p_matInst.AddColHeader(headerInst);
                        }
                        else
                        {
                            headerInst.MtxRowsRow = p_header.Levels[p_header.Levels.Count - 1].Row;
                            p_matInst.AddRowHeader(headerInst);
                        }
                        //生成条件
                        foreach (string name in colNames)
                        {
                            headerInst.Filter.Add(name, curRow.Str(name));
                        }
                    }

                    //后面小计
                    for (int k = p_header.Levels.Count - 1; k >= 0; k--)
                    {
                        RptMtxLevel level = p_header.Levels[k];
                        if (level.SubTotals.Count <= 0)
                        {
                            continue;
                        }
                        RptMtxLevel beforLevel = null;
                        if (p_header.Levels.IndexOf(level) - 1 >= 0)
                        {
                            beforLevel = p_header.Levels[p_header.Levels.IndexOf(level) - 1];
                        }
                        Row nextRow = null;
                        if (i < allHeaderData.Count - 1)
                        {
                            nextRow = allHeaderData[i + 1];
                        }
                        //最后一行(列) 或者 下一行(列)层值与当前行层值不同 创建小计
                        if (nextRow == null || (beforLevel != null && curRow.Str(beforLevel.Field) != nextRow.Str(beforLevel.Field)))
                        {
                            foreach (RptMtxSubtotal total in level.SubTotals)
                            {
                                CreateTotalInst(level.SubTotals, p_header, p_matInst, curRow, p_rptData, TotalLocation.After);
                            }
                        }
                    }
                }
                preRow = curRow;
            }
        }