internal void FromAutoFilter(AutoFilter af) { this.SetAllNull(); int iStartRowIndex = 1; int iStartColumnIndex = 1; int iEndRowIndex = 1; int iEndColumnIndex = 1; string sRef = af.Reference.Value; if (sRef.IndexOf(":") > 0) { if (SLTool.FormatCellReferenceRangeToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex)) { this.StartRowIndex = iStartRowIndex; this.StartColumnIndex = iStartColumnIndex; this.EndRowIndex = iEndRowIndex; this.EndColumnIndex = iEndColumnIndex; } } else { if (SLTool.FormatCellReferenceToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex)) { this.StartRowIndex = iStartRowIndex; this.StartColumnIndex = iStartColumnIndex; this.EndRowIndex = iStartRowIndex; this.EndColumnIndex = iStartColumnIndex; } } if (af.HasChildren) { SLFilterColumn fc; using (OpenXmlReader oxr = OpenXmlReader.Create(af)) { while (oxr.Read()) { if (oxr.ElementType == typeof(FilterColumn)) { fc = new SLFilterColumn(); fc.FromFilterColumn((FilterColumn)oxr.LoadCurrentElement()); this.FilterColumns.Add(fc); } else if (oxr.ElementType == typeof(SortState)) { this.SortState = new SLSortState(); this.SortState.FromSortState((SortState)oxr.LoadCurrentElement()); this.HasSortState = true; } } } } }
internal SLFilterColumn Clone() { SLFilterColumn fc = new SLFilterColumn(); fc.HasFilters = this.HasFilters; fc.Filters = this.Filters.Clone(); fc.HasTop10 = this.HasTop10; fc.Top10 = this.Top10.Clone(); fc.HasCustomFilters = this.HasCustomFilters; fc.CustomFilters = this.CustomFilters.Clone(); fc.HasDynamicFilter = this.HasDynamicFilter; fc.DynamicFilter = this.DynamicFilter.Clone(); fc.HasColorFilter = this.HasColorFilter; fc.ColorFilter = this.ColorFilter.Clone(); fc.HasIconFilter = this.HasIconFilter; fc.IconFilter = this.IconFilter.Clone(); fc.ColumnId = this.ColumnId; fc.HiddenButton = this.HiddenButton; fc.ShowButton = this.ShowButton; return(fc); }