internal ExcelPivotTablePageFieldSettings(XmlNamespaceManager ns, XmlNode topNode, ExcelPivotTableField field, int index) : base(ns, topNode) { if (GetXmlNodeString("@hier")=="") { Hier = -1; } _field = field; }
internal ExcelPivotTableDataField(XmlNamespaceManager ns, XmlNode topNode,ExcelPivotTableField field) : base(ns, topNode) { if (topNode.Attributes.Count == 0) { Index = field.Index; BaseField = 0; BaseItem = 0; } Field = field; }
private ExcelPivotTableField AddField(eDateGroupBy groupBy, DateTime startDate, DateTime endDate, ref bool firstField, int interval) { if (firstField == false) { //Pivot field var topNode = _table.PivotTableXml.SelectSingleNode("//d:pivotFields", _table.NameSpaceManager); var fieldNode = _table.PivotTableXml.CreateElement("pivotField", ExcelPackage.schemaMain); fieldNode.SetAttribute("compact", "0"); fieldNode.SetAttribute("outline", "0"); fieldNode.SetAttribute("showAll", "0"); fieldNode.SetAttribute("defaultSubtotal", "0"); topNode.AppendChild(fieldNode); var field = new ExcelPivotTableField(_table.NameSpaceManager, fieldNode, _table, _table.Fields.Count, Index); field.DateGrouping = groupBy; XmlNode rowColFields; if (IsRowField) { rowColFields=TopNode.SelectSingleNode("../../d:rowFields", NameSpaceManager); } else { rowColFields = TopNode.SelectSingleNode("../../d:colFields", NameSpaceManager); } int fieldIndex, index = 0; foreach (XmlElement rowfield in rowColFields.ChildNodes) { if (int.TryParse(rowfield.GetAttribute("x"), out fieldIndex)) { if (_table.Fields[fieldIndex].BaseIndex == BaseIndex) { var newElement = rowColFields.OwnerDocument.CreateElement("field", ExcelPackage.schemaMain); newElement.SetAttribute("x", field.Index.ToString()); rowColFields.InsertBefore(newElement, rowfield); break; } } index++; } if (IsRowField) { _table.RowFields.Insert(field, index); } else { _table.ColumnFields.Insert(field, index); } _table.Fields.AddInternal(field); AddCacheField(field, startDate, endDate, interval); return field; } else { firstField = false; DateGrouping = groupBy; Compact = false; SetDateGroup(groupBy, startDate, endDate, interval); return this; } }
private void AddCacheField(ExcelPivotTableField field, DateTime startDate, DateTime endDate, int interval) { //Add Cache definition field. var cacheTopNode = _table.CacheDefinition.CacheDefinitionXml.SelectSingleNode("//d:cacheFields", _table.NameSpaceManager); var cacheFieldNode = _table.CacheDefinition.CacheDefinitionXml.CreateElement("cacheField", ExcelPackage.schemaMain); cacheFieldNode.SetAttribute("name", field.DateGrouping.ToString()); cacheFieldNode.SetAttribute("databaseField", "0"); cacheTopNode.AppendChild(cacheFieldNode); field.SetCacheFieldNode(cacheFieldNode); field.SetDateGroup(field.DateGrouping, startDate, endDate, interval); }
internal ExcelPivotTableFieldItem(XmlNamespaceManager ns, XmlNode topNode, ExcelPivotTableField field) : base(ns, topNode) { _field = field; }