コード例 #1
0
 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);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 internal void Remove(ExcelSlicerXmlSource source)
 {
     _list.Remove(source);
     _part.Package.DeletePart(source.Uri);
 }