internal XmlNode GetSource(string name, eSlicerSourceType sourceType, out ExcelSlicerXmlSource source) { foreach (var s in GetSources(sourceType)) { var n = s.XmlDocument.DocumentElement.SelectSingleNode($"x14:slicer[@name=\"{name}\"]", NameSpaceManager); if (n != null) { source = s; return(n); } } source = null; return(null); }
internal ExcelSlicerXmlSource GetOrCreateSource(eSlicerSourceType sourceType) { var src = GetSources(sourceType).FirstOrDefault(); if (src == null) { switch (sourceType) { case eSlicerSourceType.Table: src = new ExcelSlicerXmlSource(eSlicerSourceType.Table, _part, null); _list.Add(src); break; case eSlicerSourceType.PivotTable: src = new ExcelSlicerXmlSource(eSlicerSourceType.PivotTable, _part, null); _list.Add(src); break; } } return(src); }
internal void Remove(ExcelSlicerXmlSource source) { _list.Remove(source); _part.Package.DeletePart(source.Uri); }