示例#1
0
        internal void LoadItems()
        {
            _items = new ExcelPivotTableFieldItemsCollection(this);
            if (Cache.DatabaseField == false)
            {
                return;
            }
            EPPlusReadOnlyList <object> cacheItems;

            if (Cache.Grouping == null)
            {
                cacheItems = Cache.SharedItems;
            }
            else
            {
                cacheItems = Cache.GroupItems;
            }

            foreach (XmlElement node in TopNode.SelectNodes("d:items//d:item", NameSpaceManager))
            {
                var item = new ExcelPivotTableFieldItem(node);
                if (item.X >= 0)
                {
                    item.Value = cacheItems[item.X];
                }
                _items.AddInternal(item);
            }
        }
示例#2
0
        internal void UpdateGroupItems(ExcelPivotTableCacheField cacheField, bool addTypeDefault)
        {
            XmlElement itemsNode = CreateNode("d:items") as XmlElement;

            _items = new ExcelPivotTableFieldItemsCollection(this);
            itemsNode.RemoveAll();
            for (int x = 0; x < cacheField.GroupItems.Count; x++)
            {
                _items.AddInternal(new ExcelPivotTableFieldItem()
                {
                    X = x, Value = cacheField.GroupItems[x]
                });
            }
            if (addTypeDefault)
            {
                _items.AddInternal(new ExcelPivotTableFieldItem()
                {
                    Type = eItemType.Default
                });
            }
        }