internal SLSortCondition Clone() { var sc = new SLSortCondition(); sc.Descending = Descending; sc.HasSortBy = HasSortBy; sc.vSortBy = vSortBy; sc.StartRowIndex = StartRowIndex; sc.StartColumnIndex = StartColumnIndex; sc.EndRowIndex = EndRowIndex; sc.EndColumnIndex = EndColumnIndex; sc.CustomList = CustomList; sc.FormatId = FormatId; sc.HasIconSet = HasIconSet; sc.vIconSet = vIconSet; sc.IconId = IconId; return(sc); }
internal void FromSortState(SortState ss) { SetAllNull(); if ((ss.ColumnSort != null) && ss.ColumnSort.Value) { ColumnSort = ss.ColumnSort.Value; } if ((ss.CaseSensitive != null) && ss.CaseSensitive.Value) { CaseSensitive = ss.CaseSensitive.Value; } if (ss.SortMethod != null) { SortMethod = ss.SortMethod.Value; } var iStartRowIndex = 1; var iStartColumnIndex = 1; var iEndRowIndex = 1; var iEndColumnIndex = 1; var sRef = ss.Reference.Value; if (sRef.IndexOf(":") > 0) { if (SLTool.FormatCellReferenceRangeToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex)) { StartRowIndex = iStartRowIndex; StartColumnIndex = iStartColumnIndex; EndRowIndex = iEndRowIndex; EndColumnIndex = iEndColumnIndex; } } else { if (SLTool.FormatCellReferenceToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex)) { StartRowIndex = iStartRowIndex; StartColumnIndex = iStartColumnIndex; EndRowIndex = iStartRowIndex; EndColumnIndex = iStartColumnIndex; } } if (ss.HasChildren) { SLSortCondition sc; using (var oxr = OpenXmlReader.Create(ss)) { while (oxr.Read()) { if (oxr.ElementType == typeof(SortCondition)) { sc = new SLSortCondition(); sc.FromSortCondition((SortCondition)oxr.LoadCurrentElement()); // limit of 64 from Open XML specs if (SortConditions.Count < 64) { SortConditions.Add(sc); } } } } } }