internal void Init(ExcelTableColumn column, string cacheName) { TableColumn = column; var wb = column.Table.WorkSheet.Workbook; CreatePart(wb); SlicerCacheXml.DocumentElement.InnerXml = $"<extLst><x:ext uri=\"{ExtLstUris.TableSlicerCacheUri}\" xmlns:x15=\"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main\"><x15:tableSlicerCache tableId=\"{column.Table.Id}\" column=\"{column.Id}\"/></x:ext></extLst>"; TopNode = SlicerCacheXml.DocumentElement; Name = cacheName; SourceName = column.Name; SlicerCacheXml.Save(Part.GetStream(FileMode.Create, FileAccess.Write)); CreateWorkbookReference(wb, ExtLstUris.WorkbookSlicerTableUri); }
internal void Init(ExcelWorkbook wb, string name, ExcelPivotTableField field) { if (wb._slicerCaches == null) { wb.LoadSlicerCaches(); } CreatePart(wb); TopNode = SlicerCacheXml.DocumentElement; Name = "Slicer_" + ExcelAddressUtil.GetValidName(name); _field = field; SourceName = _field.Cache.Name; wb.Names.AddFormula(Name, "#N/A"); PivotTables.Add(_field._pivotTable); CreateWorkbookReference(wb, ExtLstUris.WorkbookSlicerPivotTableUri); SlicerCacheXml.Save(Part.GetStream()); Data.Items.Refresh(); }