Exemplo n.º 1
0
        internal static TXlsxPivotCache Load(TOpenXmlReader DataStream)
        {
            TXlsxPivotCache Result = new TXlsxPivotCache();

            Result.FCacheId = DataStream.GetAttributeAsLong("cacheId", -1);
            Result.ReadPivotCache(DataStream, DataStream.GetRelationship("id"));
            DataStream.FinishTagAndIgnoreChildren();
            return(Result);
        }
Exemplo n.º 2
0
        internal void ReadPivotTable(TOpenXmlReader DataStream, TXlsxPivotCacheList PivotCacheList)
        {
            /* Fields that need updating:
             * location
             * filter
             */
            LoadAtts(DataStream, false);
            long cid = DataStream.GetAttributeAsLong("cacheId", -1);

            if (cid >= 0)
            {
                FCache = PivotCacheList.FindCacheFromDisk(cid);
            }

            if (DataStream.IsSimpleTag)
            {
                DataStream.NextTag(); return;
            }
            string StartElement = DataStream.RecordName();

            if (!DataStream.NextTag())
            {
                return;
            }

            while (!DataStream.AtEndElement(StartElement))
            {
                switch (DataStream.RecordName())
                {
                case "location":
                    ReadLocation(DataStream);
                    break;

                case "pivotFields":
                case "rowFields":
                case "rowItems":
                case "colFields":
                case "colItems":
                case "pageFields":
                case "dataFields":
                case "formats":
                case "conditionalFormats":
                case "chartFormats":
                case "pivotHierarchies":
                case "pivotTableStyleInfo":
                case "filters":
                case "rowHierarchiesUsage":
                case "colHierarchiesUsage":
                case "extLst":
                default:
                    FRecords.Add(new TXlsxPivotTableRecord(DataStream.GetXml()));
                    break;
                }
            }
        }