コード例 #1
0
        internal SLMembers Clone()
        {
            var m = new SLMembers();

            m.Level = Level;

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

            return(m);
        }
コード例 #2
0
        internal void FromPivotHierarchy(PivotHierarchy ph)
        {
            SetAllNull();

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

            SLMemberProperty mp;
            SLMembers        mems;

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