internal SLItem Clone()
        {
            var it = new SLItem();

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

            return(it);
        }
Exemple #2
0
        internal void FromPivotField(PivotField pf)
        {
            SetAllNull();

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

            SLItem it;

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