Ejemplo n.º 1
0
 private void SetAllNull()
 {
     FilterColumns    = new List <SLFilterColumn>();
     SortState        = new SLSortState();
     HasSortState     = false;
     StartRowIndex    = 1;
     StartColumnIndex = 1;
     EndRowIndex      = 1;
     EndColumnIndex   = 1;
 }
Ejemplo n.º 2
0
        internal void FromAutoFilter(AutoFilter af)
        {
            SetAllNull();

            var iStartRowIndex    = 1;
            var iStartColumnIndex = 1;
            var iEndRowIndex      = 1;
            var iEndColumnIndex   = 1;
            var sRef = af.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 (af.HasChildren)
            {
                SLFilterColumn fc;
                using (var oxr = OpenXmlReader.Create(af))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(FilterColumn))
                        {
                            fc = new SLFilterColumn();
                            fc.FromFilterColumn((FilterColumn)oxr.LoadCurrentElement());
                            FilterColumns.Add(fc);
                        }
                        else if (oxr.ElementType == typeof(SortState))
                        {
                            SortState = new SLSortState();
                            SortState.FromSortState((SortState)oxr.LoadCurrentElement());
                            HasSortState = true;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        internal SLSortState Clone()
        {
            var ss = new SLSortState();

            ss.SortConditions = new List <SLSortCondition>();
            for (var i = 0; i < SortConditions.Count; ++i)
            {
                ss.SortConditions.Add(SortConditions[i].Clone());
            }

            ss.ColumnSort    = ColumnSort;
            ss.CaseSensitive = CaseSensitive;

            ss.HasSortMethod = HasSortMethod;
            ss.vSortMethod   = vSortMethod;

            ss.StartRowIndex    = StartRowIndex;
            ss.StartColumnIndex = StartColumnIndex;
            ss.EndRowIndex      = EndRowIndex;
            ss.EndColumnIndex   = EndColumnIndex;

            return(ss);
        }