コード例 #1
0
 private void MergeVGroupCells()
 {
     foreach (var line in TplLineList)
     {
         var colIndex = line.StartColumnIndex;
         foreach (var cell in line.CellList)
         {
             if ((cell.MergeOption != MergeOption.Up) ||
                 ((cell.GroupAlign != GroupAlign.None) && (cell.GroupAlign != GroupAlign.Always)))
             {
                 colIndex++;
             }
             else
             {
                 foreach (var startRow in line.InsertedRowList)
                 {
                     var currentCellRange = RangeHelper.GetCell(TplRange.Worksheet, colIndex, startRow);
                     if (!currentCellRange.HasMerged)
                     {
                         RangeHelper.MergeRanges(currentCellRange, MergeOption.Up);
                     }
                 }
                 colIndex++;
             }
         }
     }
 }
コード例 #2
0
 private void MergeHGroupCells()
 {
     for (var i = 0; i < TplLineList.Count; i++)
     {
         var line = TplLineList[i];
         if (line.ContainsHGroup)
         {
             foreach (var startRow in line.InsertedRowList)
             {
                 object objA          = null;
                 var    startColIndex = DynamicColumn.StartColIndex;
                 for (var k = 0; k < DynamicColumn.InsertCount; k++)
                 {
                     var currentCellRange = RangeHelper.GetCell(TplRange.Worksheet, startColIndex, startRow);
                     var objB             = currentCellRange.Value2;
                     if ((objA != null) && Equals(objA, objB))
                     {
                         if ((i == (TplLineList.Count - 1)) || TplLineList[i + 1].ContainsHGroup)
                         {
                             RangeHelper.MergeRanges(currentCellRange, MergeOption.Left);
                         }
                         else if ((k % DynamicColumn.GroupColumnCount) > 0)
                         {
                             RangeHelper.MergeRanges(currentCellRange, MergeOption.Left);
                         }
                     }
                     objA = objB;
                     startColIndex++;
                 }
                 var num6 = DynamicColumn.StartCellIndex + DynamicColumn.InsertCount;
                 for (var m = num6; m < line.CellList.Count; m++)
                 {
                     var cell = line.CellList[m];
                     if (cell.MergeOption == MergeOption.Left)
                     {
                         RangeHelper.MergeRanges(
                             RangeHelper.GetCell(TplRange.Worksheet, startColIndex, startRow), MergeOption.Left);
                     }
                     startColIndex++;
                 }
             }
         }
     }
 }
コード例 #3
0
 public bool DoMerge(CellRange currentCellRange)
 {
     return(currentCellRange != null && RangeHelper.MergeRanges(currentCellRange, MergeOption));
 }