Beispiel #1
0
        internal AutoSortScope ToAutoSortScope()
        {
            AutoSortScope ass = new AutoSortScope();

            ass.PivotArea = this.PivotArea.ToPivotArea();

            return(ass);
        }
Beispiel #2
0
        // ahahahahah... I did *not* just come up with this variable name... :)
        internal void FromAutoSortScope(AutoSortScope ass)
        {
            this.SetAllNull();

            if (ass.PivotArea != null)
            {
                this.PivotArea.FromPivotArea(ass.PivotArea);
            }
        }
Beispiel #3
0
        internal SLPivotField Clone()
        {
            var pf = new SLPivotField();

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

            pf.Items = new List <SLItem>();
            foreach (var it in Items)
            {
                pf.Items.Add(it.Clone());
            }

            pf.AutoSortScope    = AutoSortScope.Clone();
            pf.HasAutoSortScope = HasAutoSortScope;

            return(pf);
        }
Beispiel #4
0
        internal PivotField ToPivotField()
        {
            var pf = new PivotField();

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

            if (Items.Count > 0)
            {
                pf.Items = new Items();
                foreach (var it in Items)
                {
                    pf.Items.Append(it.ToItem());
                }
            }

            if (HasAutoSortScope)
            {
                pf.AutoSortScope = AutoSortScope.ToAutoSortScope();
            }

            return(pf);
        }
Beispiel #5
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;
                    }
                }
            }
        }