internal void LoadXlsx(TOpenXmlReader DataStream) { AutoPage = DataStream.GetAttributeAsBool("autoPage", false); if (DataStream.IsSimpleTag) { DataStream.NextTag(); return; } string StartElement = DataStream.RecordName(); if (!DataStream.NextTag()) { return; } while (!DataStream.AtEndElement(StartElement)) { switch (DataStream.RecordName()) { case "pages": Pages = DataStream.GetXml(); break; case "rangeSets": ReadRangeSets(DataStream); break; default: DataStream.GetXml(); //Shouldn't happen. break; } } }
private void ReadRangeSets(TOpenXmlReader DataStream) { if (DataStream.IsSimpleTag) { DataStream.NextTag(); return; } string StartElement = DataStream.RecordName(); if (!DataStream.NextTag()) { return; } while (!DataStream.AtEndElement(StartElement)) { switch (DataStream.RecordName()) { case "rangeSet": RangeSets.Add(TRangeSet.LoadFromXlsx(DataStream)); break; default: DataStream.GetXml(); //Shouldn't happen. break; } } }
private void ReadCacheSource(TOpenXmlReader DataStream) { string SourceType = DataStream.GetAttribute("type"); if (SourceType == "external") { FRecords.Add(new TXlsxPivotCacheRecord(DataStream.GetXml())); return; } if (DataStream.IsSimpleTag) { DataStream.NextTag(); return; } string StartElement = DataStream.RecordName(); if (!DataStream.NextTag()) { return; } TCacheSourceRecord R = new TCacheSourceRecord(SourceType, DataStream.GetAttributeAsLong("connectionId", -1)); FRecords.Add(R); while (!DataStream.AtEndElement(StartElement)) { switch (DataStream.RecordName()) { case "consolidation": ReadConsolidation(DataStream, R); break; case "worksheetSource": ReadWorksheetSource(DataStream, R); break; case "extLst": default: TFutureStorage.Add(ref R.FutureStorage, new TFutureStorageRecord(DataStream.GetXml())); break; } } }
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; } } }
internal void ReadChart(string relId, TFlxChart Chart) { DataStream.SelectFromCurrentPartAndPush(relId, TOpenXmlManager.ChartNamespace, false); while (DataStream.NextTag()) { switch (DataStream.RecordName()) { case "chartSpace": ReadChartSpace(Chart); break; default: //shouldn't happen DataStream.GetXml(); break; } } DataStream.PopPart(); }
private void ReadPivotCacheDefinition(TOpenXmlReader DataStream) { LoadAtts(DataStream, true); /* Fields that need updating: * cacheFields->formula * cacheSource.consolidation.rangeSets.rangeSet->ref * cacheSource.worksheetSource->ref * calculatedItems doesn't need it because formulas don't have cell refs. */ if (DataStream.IsSimpleTag) { DataStream.NextTag(); return; } string StartElement = DataStream.RecordName(); if (!DataStream.NextTag()) { return; } while (!DataStream.AtEndElement(StartElement)) { switch (DataStream.RecordName()) { case "cacheSource": ReadCacheSource(DataStream); break; case "cacheFields": //break; case "cacheHierarchies": case "kpis": case "tupleCache": case "calculatedItems": case "calculatedMembers": case "dimensions": case "measureGroups": case "maps": case "extLst": default: FRecords.Add(new TXlsxPivotCacheRecord(DataStream.GetXml())); break; } } }
internal TShapeGeom ReadShapeDef(string GeomName) { TShapeGeom Result = new TShapeGeom(GeomName); string DefaultNamespace = DataStream.DefaultNamespace; DataStream.DefaultNamespace = "http://schemas.openxmlformats.org/drawingml/2006/main"; try { string StartElement = DataStream.RecordName(); if (DataStream.IsSimpleTag) { DataStream.NextTag(); return(Result); } if (!DataStream.NextTag()) { return(Result); } while (!DataStream.AtEndElement(StartElement)) { switch (DataStream.RecordName()) { case "avLst": ReadGdLst(Result.AvList, Result); break; case "gdLst": ReadGdLst(Result.GdList, Result); break; case "ahLst": ReadAhLst(Result.AhList, Result); break; case "cxnLst": ReadCxnLst(Result.ConnList, Result); break; case "rect": Result.TextRect = ReadRect(Result); break; case "pathLst": ReadPathLst(Result); break; default: DataStream.GetXml(); break; } } } finally { DataStream.DefaultNamespace = DefaultNamespace; } return(Result); }
internal void ReadPivotCache(TOpenXmlReader DataStream, string relId) { DataStream.SelectFromCurrentPartAndPush(relId, TOpenXmlManager.MainNamespace, false); while (DataStream.NextTag()) { switch (DataStream.RecordName()) { case "pivotCacheDefinition": ReadPivotCacheDefinition(DataStream); break; default: //shouldn't happen DataStream.GetXml(); break; } } DataStream.PopPart(); }