private void GroupResult()
        {
            if (string.IsNullOrWhiteSpace(GroupBy))
            {
                return;
            }

            int[] groupColOrRowNumbers = GroupBy.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(strNum =>
            {
                if (int.TryParse(strNum, out int num))
                {
                    return(num);
                }
                throw new InvalidCastException($"Parse \"{nameof(GroupBy)}\" property failed. Cannot convert value \"{strNum.Trim()}\" to {nameof(Int32)}");
            }).ToArray();

            if (Type == PanelType.Vertical)
            {
                GroupCellsVertical(ResultRange, groupColOrRowNumbers);
            }
            else
            {
                GroupCellsHorizontal(ResultRange, groupColOrRowNumbers);
            }
        }
Exemple #2
0
 public string[] GetGroupByFields()
 {
     if (!string.IsNullOrEmpty(GroupBy))
     {
         var _fieldArgs = GroupBy.Split(new char[] { '-' });
         return(_fieldArgs);
     }
     return(null);
 }