コード例 #1
0
        internal void CreateValueCustomFilter(ePivotTableValueFilterType type)
        {
            _filterColumnNode.InnerXml = "<customFilters/>";
            var cf = new ExcelCustomFilterColumn(NameSpaceManager, _filterColumnNode);

            eFilterOperator t;
            string          v1 = GetFilterValueAsString(Value1);

            switch (type)
            {
            case ePivotTableValueFilterType.ValueNotEqual:
                t = eFilterOperator.NotEqual;
                break;

            case ePivotTableValueFilterType.ValueGreaterThan:
                t = eFilterOperator.GreaterThan;
                break;

            case ePivotTableValueFilterType.ValueGreaterThanOrEqual:
            case ePivotTableValueFilterType.ValueBetween:
                t = eFilterOperator.GreaterThanOrEqual;
                break;

            case ePivotTableValueFilterType.ValueLessThan:
                t = eFilterOperator.LessThan;
                break;

            case ePivotTableValueFilterType.ValueLessThanOrEqual:
            case ePivotTableValueFilterType.ValueNotBetween:
                t = eFilterOperator.LessThanOrEqual;
                break;

            default:
                t = eFilterOperator.Equal;
                break;
            }

            var item1 = new ExcelFilterCustomItem(v1, t);

            cf.Filters.Add(item1);

            if (type == ePivotTableValueFilterType.ValueBetween)
            {
                cf.And = true;
                cf.Filters.Add(new ExcelFilterCustomItem(GetFilterValueAsString(Value2), eFilterOperator.LessThanOrEqual));
            }
            else if (type == ePivotTableValueFilterType.ValueNotBetween)
            {
                cf.And = false;
                cf.Filters.Add(new ExcelFilterCustomItem(GetFilterValueAsString(Value2), eFilterOperator.GreaterThan));
            }
            _filter = cf;
        }
コード例 #2
0
        internal void CreateDateCustomFilter(ePivotTableDateValueFilterType type)
        {
            _filterColumnNode.InnerXml = "<customFilters/>";
            var cf = new ExcelCustomFilterColumn(NameSpaceManager, _filterColumnNode);

            eFilterOperator t;
            var             v = ConvertUtil.GetValueForXml(Value1, _date1904);

            switch (type)
            {
            case ePivotTableDateValueFilterType.DateNotEqual:
                t = eFilterOperator.NotEqual;
                break;

            case ePivotTableDateValueFilterType.DateNewerThan:
            case ePivotTableDateValueFilterType.DateBetween:
                t = eFilterOperator.GreaterThan;
                break;

            case ePivotTableDateValueFilterType.DateNewerThanOrEqual:
                t = eFilterOperator.GreaterThanOrEqual;
                break;

            case ePivotTableDateValueFilterType.DateOlderThan:
            case ePivotTableDateValueFilterType.DateNotBetween:
                t = eFilterOperator.LessThan;
                break;

            case ePivotTableDateValueFilterType.DateOlderThanOrEqual:
                t = eFilterOperator.LessThanOrEqual;
                break;

            default:
                t = eFilterOperator.Equal;
                break;
            }

            var item1 = new ExcelFilterCustomItem(v, t);

            cf.Filters.Add(item1);

            if (type == ePivotTableDateValueFilterType.DateBetween)
            {
                cf.And = true;
                cf.Filters.Add(new ExcelFilterCustomItem(ConvertUtil.GetValueForXml(Value2, _date1904), eFilterOperator.LessThanOrEqual));
            }
            else if (type == ePivotTableDateValueFilterType.DateNotBetween)
            {
                cf.And = false;
                cf.Filters.Add(new ExcelFilterCustomItem(ConvertUtil.GetValueForXml(Value2, _date1904), eFilterOperator.GreaterThan));
            }
            _filter = cf;
        }
コード例 #3
0
        internal void CreateCaptionCustomFilter(ePivotTableCaptionFilterType type)
        {
            _filterColumnNode.InnerXml = "<customFilters/>";
            var cf = new ExcelCustomFilterColumn(NameSpaceManager, _filterColumnNode);

            eFilterOperator t;
            var             v = StringValue1;

            switch (type)
            {
            case ePivotTableCaptionFilterType.CaptionNotBeginsWith:
            case ePivotTableCaptionFilterType.CaptionNotContains:
            case ePivotTableCaptionFilterType.CaptionNotEndsWith:
            case ePivotTableCaptionFilterType.CaptionNotEqual:
                t = eFilterOperator.NotEqual;
                break;

            case ePivotTableCaptionFilterType.CaptionGreaterThan:
                t = eFilterOperator.GreaterThan;
                break;

            case ePivotTableCaptionFilterType.CaptionGreaterThanOrEqual:
            case ePivotTableCaptionFilterType.CaptionBetween:
                t = eFilterOperator.GreaterThanOrEqual;
                break;

            case ePivotTableCaptionFilterType.CaptionLessThan:
            case ePivotTableCaptionFilterType.CaptionNotBetween:
                t = eFilterOperator.LessThan;
                break;

            case ePivotTableCaptionFilterType.CaptionLessThanOrEqual:
                t = eFilterOperator.LessThanOrEqual;
                break;

            default:
                t = eFilterOperator.Equal;
                break;
            }
            switch (type)
            {
            case ePivotTableCaptionFilterType.CaptionBeginsWith:
            case ePivotTableCaptionFilterType.CaptionNotBeginsWith:
                v += "*";
                break;

            case ePivotTableCaptionFilterType.CaptionContains:
            case ePivotTableCaptionFilterType.CaptionNotContains:
                v = $"*{v}*";
                break;

            case ePivotTableCaptionFilterType.CaptionEndsWith:
            case ePivotTableCaptionFilterType.CaptionNotEndsWith:
                v = $"*{v}";
                break;
            }
            var item1 = new ExcelFilterCustomItem(v, t);

            cf.Filters.Add(item1);

            if (type == ePivotTableCaptionFilterType.CaptionBetween)
            {
                cf.And = true;
                cf.Filters.Add(new ExcelFilterCustomItem(StringValue2, eFilterOperator.LessThanOrEqual));
            }
            else if (type == ePivotTableCaptionFilterType.CaptionNotBetween)
            {
                cf.And = false;
                cf.Filters.Add(new ExcelFilterCustomItem(StringValue2, eFilterOperator.GreaterThan));
            }

            _filter = cf;
        }