Exemplo n.º 1
0
        internal SLItem Clone()
        {
            SLItem it = new SLItem();

            it.ItemName              = this.ItemName;
            it.ItemType              = this.ItemType;
            it.Hidden                = this.Hidden;
            it.HasStringVlue         = this.HasStringVlue;
            it.HideDetails           = this.HideDetails;
            it.Calculated            = this.Calculated;
            it.Missing               = this.Missing;
            it.ChildItems            = this.ChildItems;
            it.Index                 = this.Index;
            it.Expanded              = this.Expanded;
            it.DrillAcrossAttributes = this.DrillAcrossAttributes;

            return(it);
        }
        internal void FromPivotField(PivotField pf)
        {
            this.SetAllNull();

            if (pf.Name != null)
            {
                this.Name = pf.Name.Value;
            }
            if (pf.Axis != null)
            {
                this.Axis = pf.Axis.Value;
            }
            if (pf.DataField != null)
            {
                this.DataField = pf.DataField.Value;
            }
            if (pf.SubtotalCaption != null)
            {
                this.SubtotalCaption = pf.SubtotalCaption.Value;
            }
            if (pf.ShowDropDowns != null)
            {
                this.ShowDropDowns = pf.ShowDropDowns.Value;
            }
            if (pf.HiddenLevel != null)
            {
                this.HiddenLevel = pf.HiddenLevel.Value;
            }
            if (pf.UniqueMemberProperty != null)
            {
                this.UniqueMemberProperty = pf.UniqueMemberProperty.Value;
            }
            if (pf.Compact != null)
            {
                this.Compact = pf.Compact.Value;
            }
            if (pf.AllDrilled != null)
            {
                this.AllDrilled = pf.AllDrilled.Value;
            }
            if (pf.NumberFormatId != null)
            {
                this.NumberFormatId = pf.NumberFormatId.Value;
            }
            if (pf.Outline != null)
            {
                this.Outline = pf.Outline.Value;
            }
            if (pf.SubtotalTop != null)
            {
                this.SubtotalTop = pf.SubtotalTop.Value;
            }
            if (pf.DragToRow != null)
            {
                this.DragToRow = pf.DragToRow.Value;
            }
            if (pf.DragToColumn != null)
            {
                this.DragToColumn = pf.DragToColumn.Value;
            }
            if (pf.MultipleItemSelectionAllowed != null)
            {
                this.MultipleItemSelectionAllowed = pf.MultipleItemSelectionAllowed.Value;
            }
            if (pf.DragToPage != null)
            {
                this.DragToPage = pf.DragToPage.Value;
            }
            if (pf.DragToData != null)
            {
                this.DragToData = pf.DragToData.Value;
            }
            if (pf.DragOff != null)
            {
                this.DragOff = pf.DragOff.Value;
            }
            if (pf.ShowAll != null)
            {
                this.ShowAll = pf.ShowAll.Value;
            }
            if (pf.InsertBlankRow != null)
            {
                this.InsertBlankRow = pf.InsertBlankRow.Value;
            }
            if (pf.ServerField != null)
            {
                this.ServerField = pf.ServerField.Value;
            }
            if (pf.InsertPageBreak != null)
            {
                this.InsertPageBreak = pf.InsertPageBreak.Value;
            }
            if (pf.AutoShow != null)
            {
                this.AutoShow = pf.AutoShow.Value;
            }
            if (pf.TopAutoShow != null)
            {
                this.TopAutoShow = pf.TopAutoShow.Value;
            }
            if (pf.HideNewItems != null)
            {
                this.HideNewItems = pf.HideNewItems.Value;
            }
            if (pf.MeasureFilter != null)
            {
                this.MeasureFilter = pf.MeasureFilter.Value;
            }
            if (pf.IncludeNewItemsInFilter != null)
            {
                this.IncludeNewItemsInFilter = pf.IncludeNewItemsInFilter.Value;
            }
            if (pf.ItemPageCount != null)
            {
                this.ItemPageCount = pf.ItemPageCount.Value;
            }
            if (pf.SortType != null)
            {
                this.SortType = pf.SortType.Value;
            }
            if (pf.DataSourceSort != null)
            {
                this.DataSourceSort = pf.DataSourceSort.Value;
            }
            if (pf.NonAutoSortDefault != null)
            {
                this.NonAutoSortDefault = pf.NonAutoSortDefault.Value;
            }
            if (pf.RankBy != null)
            {
                this.RankBy = pf.RankBy.Value;
            }
            if (pf.DefaultSubtotal != null)
            {
                this.DefaultSubtotal = pf.DefaultSubtotal.Value;
            }
            if (pf.SumSubtotal != null)
            {
                this.SumSubtotal = pf.SumSubtotal.Value;
            }
            if (pf.CountASubtotal != null)
            {
                this.CountASubtotal = pf.CountASubtotal.Value;
            }
            if (pf.AverageSubTotal != null)
            {
                this.AverageSubTotal = pf.AverageSubTotal.Value;
            }
            if (pf.MaxSubtotal != null)
            {
                this.MaxSubtotal = pf.MaxSubtotal.Value;
            }
            if (pf.MinSubtotal != null)
            {
                this.MinSubtotal = pf.MinSubtotal.Value;
            }
            if (pf.ApplyProductInSubtotal != null)
            {
                this.ApplyProductInSubtotal = pf.ApplyProductInSubtotal.Value;
            }
            if (pf.CountSubtotal != null)
            {
                this.CountSubtotal = pf.CountSubtotal.Value;
            }
            if (pf.ApplyStandardDeviationInSubtotal != null)
            {
                this.ApplyStandardDeviationInSubtotal = pf.ApplyStandardDeviationInSubtotal.Value;
            }
            if (pf.ApplyStandardDeviationPInSubtotal != null)
            {
                this.ApplyStandardDeviationPInSubtotal = pf.ApplyStandardDeviationPInSubtotal.Value;
            }
            if (pf.ApplyVarianceInSubtotal != null)
            {
                this.ApplyVarianceInSubtotal = pf.ApplyVarianceInSubtotal.Value;
            }
            if (pf.ApplyVariancePInSubtotal != null)
            {
                this.ApplyVariancePInSubtotal = pf.ApplyVariancePInSubtotal.Value;
            }
            if (pf.ShowPropCell != null)
            {
                this.ShowPropCell = pf.ShowPropCell.Value;
            }
            if (pf.ShowPropertyTooltip != null)
            {
                this.ShowPropertyTooltip = pf.ShowPropertyTooltip.Value;
            }
            if (pf.ShowPropAsCaption != null)
            {
                this.ShowPropAsCaption = pf.ShowPropAsCaption.Value;
            }
            if (pf.DefaultAttributeDrillState != null)
            {
                this.DefaultAttributeDrillState = pf.DefaultAttributeDrillState.Value;
            }

            SLItem it;

            using (OpenXmlReader oxr = OpenXmlReader.Create(pf))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(Item))
                    {
                        it = new SLItem();
                        it.FromItem((Item)oxr.LoadCurrentElement());
                        this.Items.Add(it);
                    }
                    else if (oxr.ElementType == typeof(AutoSortScope))
                    {
                        this.AutoSortScope.FromAutoSortScope((AutoSortScope)oxr.LoadCurrentElement());
                        this.HasAutoSortScope = true;
                    }
                }
            }
        }