示例#1
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);
                    }
                }
            }
        }
示例#2
0
        internal PivotHierarchy ToPivotHierarchy()
        {
            PivotHierarchy ph = new PivotHierarchy();

            if (this.Outline != false)
            {
                ph.Outline = this.Outline;
            }
            if (this.MultipleItemSelectionAllowed != false)
            {
                ph.MultipleItemSelectionAllowed = this.MultipleItemSelectionAllowed;
            }
            if (this.SubtotalTop != false)
            {
                ph.SubtotalTop = this.SubtotalTop;
            }
            if (this.ShowInFieldList != true)
            {
                ph.ShowInFieldList = this.ShowInFieldList;
            }
            if (this.DragToRow != true)
            {
                ph.DragToRow = this.DragToRow;
            }
            if (this.DragToColumn != true)
            {
                ph.DragToColumn = this.DragToColumn;
            }
            if (this.DragToPage != true)
            {
                ph.DragToPage = this.DragToPage;
            }
            if (this.DragToData != false)
            {
                ph.DragToData = this.DragToData;
            }
            if (this.DragOff != true)
            {
                ph.DragOff = this.DragOff;
            }
            if (this.IncludeNewItemsInFilter != false)
            {
                ph.IncludeNewItemsInFilter = this.IncludeNewItemsInFilter;
            }
            if (this.Caption != null && this.Caption.Length > 0)
            {
                ph.Caption = this.Caption;
            }

            if (this.MemberProperties.Count > 0)
            {
                ph.MemberProperties = new MemberProperties()
                {
                    Count = (uint)this.MemberProperties.Count
                };
                foreach (SLMemberProperty mp in this.MemberProperties)
                {
                    ph.MemberProperties.Append(mp.ToMemberProperty());
                }
            }

            foreach (SLMembers mems in this.Members)
            {
                ph.Append(mems.ToMembers());
            }

            return(ph);
        }
        internal PivotHierarchy ToPivotHierarchy()
        {
            PivotHierarchy ph = new PivotHierarchy();

            if (this.Outline != false) ph.Outline = this.Outline;
            if (this.MultipleItemSelectionAllowed != false) ph.MultipleItemSelectionAllowed = this.MultipleItemSelectionAllowed;
            if (this.SubtotalTop != false) ph.SubtotalTop = this.SubtotalTop;
            if (this.ShowInFieldList != true) ph.ShowInFieldList = this.ShowInFieldList;
            if (this.DragToRow != true) ph.DragToRow = this.DragToRow;
            if (this.DragToColumn != true) ph.DragToColumn = this.DragToColumn;
            if (this.DragToPage != true) ph.DragToPage = this.DragToPage;
            if (this.DragToData != false) ph.DragToData = this.DragToData;
            if (this.DragOff != true) ph.DragOff = this.DragOff;
            if (this.IncludeNewItemsInFilter != false) ph.IncludeNewItemsInFilter = this.IncludeNewItemsInFilter;
            if (this.Caption != null && this.Caption.Length > 0) ph.Caption = this.Caption;

            if (this.MemberProperties.Count > 0)
            {
                ph.MemberProperties = new MemberProperties() { Count = (uint)this.MemberProperties.Count };
                foreach (SLMemberProperty mp in this.MemberProperties)
                {
                    ph.MemberProperties.Append(mp.ToMemberProperty());
                }
            }

            foreach (SLMembers mems in this.Members)
            {
                ph.Append(mems.ToMembers());
            }

            return ph;
        }
        internal PivotHierarchy ToPivotHierarchy()
        {
            var ph = new PivotHierarchy();

            if (Outline)
            {
                ph.Outline = Outline;
            }
            if (MultipleItemSelectionAllowed)
            {
                ph.MultipleItemSelectionAllowed = MultipleItemSelectionAllowed;
            }
            if (SubtotalTop)
            {
                ph.SubtotalTop = SubtotalTop;
            }
            if (ShowInFieldList != true)
            {
                ph.ShowInFieldList = ShowInFieldList;
            }
            if (DragToRow != true)
            {
                ph.DragToRow = DragToRow;
            }
            if (DragToColumn != true)
            {
                ph.DragToColumn = DragToColumn;
            }
            if (DragToPage != true)
            {
                ph.DragToPage = DragToPage;
            }
            if (DragToData)
            {
                ph.DragToData = DragToData;
            }
            if (DragOff != true)
            {
                ph.DragOff = DragOff;
            }
            if (IncludeNewItemsInFilter)
            {
                ph.IncludeNewItemsInFilter = IncludeNewItemsInFilter;
            }
            if ((Caption != null) && (Caption.Length > 0))
            {
                ph.Caption = Caption;
            }

            if (MemberProperties.Count > 0)
            {
                ph.MemberProperties = new MemberProperties {
                    Count = (uint)MemberProperties.Count
                };
                foreach (var mp in MemberProperties)
                {
                    ph.MemberProperties.Append(mp.ToMemberProperty());
                }
            }

            foreach (var mems in Members)
            {
                ph.Append(mems.ToMembers());
            }

            return(ph);
        }
        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);
                    }
                }
            }
        }