PivotGridStyleFormatCondition GetStyleFormatByValue(PivotGridCellItem cellItem, PivotGridControl pivot)
        {
            PivotGridCellType cellType = GetCellType(cellItem);
            int cnt = pivot.FormatConditions.Count;

            if (cnt == 0)
            {
                return(null);
            }
            for (int n = 0; n < cnt; n++)
            {
                PivotGridStyleFormatCondition cond = pivot.FormatConditions[n];
                if (cond.CanApplyToCell(cellType) && cond.CheckValue(cellItem.DataField, cellItem.Value, cellItem))
                {
                    return(cond);
                }
            }
            return(null);
        }
        protected PivotGridCellType GetCellType(PivotGridCellItem cellViewInfo)
        {
            PivotGridCellType cellType = PivotGridCellType.Cell;

            if (cellViewInfo.IsCustomTotalAppearance)
            {
                cellType = PivotGridCellType.CustomTotal;
            }
            else
            {
                if (cellViewInfo.IsGrandTotalAppearance)
                {
                    cellType = PivotGridCellType.GrandTotal;
                }
                if (cellViewInfo.IsTotalAppearance)
                {
                    cellType = PivotGridCellType.Total;
                }
            }
            return(cellType);
        }