Example #1
0
        private TplCloumn FindDColumn()
        {
            TplCloumn dcol = new TplCloumn();

            dcol.gCols = 0;

            for (int i = 0; i < lineList.Count; i++)
            {
                TplLine line = lineList [i];

                // int startIndex = -1 ;
                for (int j = 0; j < line.cellList.Count; j++)
                {
                    TplCell cell = line.cellList [j];

                    if (cell.align == GroupAlign.hGroup)
                    {
                        // Only One DColumn
                        if (dcol.gCols <= 0)
                        {
                            dcol.startCellIndex = j;
                            dcol.startColIndex  = cell.lastColIndex;
                        }

                        dcol.gCols++;
                    }
                }


                if (dcol.gCols > 0)
                {
                    break;
                }
            }

            if (dcol.gCols <= 0)
            {
                return(null);
            }

            dcol.tplLastColCount = tplColumCount - dcol.startCellIndex - dcol.gCols;
            if (dcol.tplLastColCount <= 0)
            {
                dcol.tplLastColCount = 1;
            }

            // find out gcells
            dcol.tplRange = RangeHelper.GetRange(tplRange.Worksheet, dcol.startColIndex
                                                 , tplRowCount, dcol.gCols, lineList.Count);

            for (int i = 0; i < lineList.Count; i++)
            {
                TplLine line = lineList [i];

                for (int j = 0; j < line.cellList.Count; j++)
                {
                    TplCell cell = line.cellList [j];

                    if (cell.align == GroupAlign.hGroup)
                    {
                        TplCell newCell = cell.Copy();
                        dcol.cellList.Add(newCell);

                        if (!dcol.groupColList.Contains(cell.tplGroupColName))
                        {
                            dcol.groupColList.Add(cell.tplGroupColName);
                            dcol.groupColIndexList.Add(-1);
                        }
                    }
                }
            }

            return(dcol);
        }
Example #2
0
 public void InitDColumn()
 {
     dColumn = FindDColumn();
 }