예제 #1
0
        internal SLMembers Clone()
        {
            SLMembers m = new SLMembers();

            m.Level = this.Level;

            m.Members = new List <string>();
            foreach (string s in this.Members)
            {
                m.Members.Add(s);
            }

            return(m);
        }
예제 #2
0
        internal void FromPivotHierarchy(PivotHierarchy ph)
        {
            this.SetAllNull();

            if (ph.Outline != null)
            {
                this.Outline = ph.Outline.Value;
            }
            if (ph.MultipleItemSelectionAllowed != null)
            {
                this.Outline = ph.MultipleItemSelectionAllowed.Value;
            }
            if (ph.SubtotalTop != null)
            {
                this.SubtotalTop = ph.SubtotalTop.Value;
            }
            if (ph.ShowInFieldList != null)
            {
                this.ShowInFieldList = ph.ShowInFieldList.Value;
            }
            if (ph.DragToRow != null)
            {
                this.DragToRow = ph.DragToRow.Value;
            }
            if (ph.DragToColumn != null)
            {
                this.DragToColumn = ph.DragToColumn.Value;
            }
            if (ph.DragToPage != null)
            {
                this.DragToPage = ph.DragToPage.Value;
            }
            if (ph.DragToData != null)
            {
                this.DragToData = ph.DragToData.Value;
            }
            if (ph.DragOff != null)
            {
                this.DragOff = ph.DragOff.Value;
            }
            if (ph.IncludeNewItemsInFilter != null)
            {
                this.IncludeNewItemsInFilter = ph.IncludeNewItemsInFilter.Value;
            }
            if (ph.Caption != null)
            {
                this.Caption = ph.Caption.Value;
            }

            SLMemberProperty mp;
            SLMembers        mems;

            using (OpenXmlReader oxr = OpenXmlReader.Create(ph))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(MemberProperty))
                    {
                        mp = new SLMemberProperty();
                        mp.FromMemberProperty((MemberProperty)oxr.LoadCurrentElement());
                        this.MemberProperties.Add(mp);
                    }
                    else if (oxr.ElementType == typeof(Members))
                    {
                        mems = new SLMembers();
                        mems.FromMembers((Members)oxr.LoadCurrentElement());
                        this.Members.Add(mems);
                    }
                }
            }
        }