Example #1
0
        internal SLPivotAreaReference Clone()
        {
            var par = new SLPivotAreaReference();

            par.Field                             = Field;
            par.Selected                          = Selected;
            par.ByPosition                        = ByPosition;
            par.Relative                          = Relative;
            par.DefaultSubtotal                   = DefaultSubtotal;
            par.SumSubtotal                       = SumSubtotal;
            par.CountASubtotal                    = CountASubtotal;
            par.AverageSubtotal                   = AverageSubtotal;
            par.MaxSubtotal                       = MaxSubtotal;
            par.MinSubtotal                       = MinSubtotal;
            par.ApplyProductInSubtotal            = ApplyProductInSubtotal;
            par.CountSubtotal                     = CountSubtotal;
            par.ApplyStandardDeviationInSubtotal  = ApplyStandardDeviationInSubtotal;
            par.ApplyStandardDeviationPInSubtotal = ApplyStandardDeviationPInSubtotal;
            par.ApplyVarianceInSubtotal           = ApplyVarianceInSubtotal;
            par.ApplyVariancePInSubtotal          = ApplyVariancePInSubtotal;

            par.FieldItems = new List <uint>();
            foreach (var i in FieldItems)
            {
                par.FieldItems.Add(i);
            }

            return(par);
        }
Example #2
0
        internal void FromPivotArea(PivotArea pa)
        {
            SetAllNull();

            if (pa.Field != null)
            {
                Field = pa.Field.Value;
            }
            if (pa.Type != null)
            {
                Type = pa.Type.Value;
            }
            if (pa.DataOnly != null)
            {
                DataOnly = pa.DataOnly.Value;
            }
            if (pa.LabelOnly != null)
            {
                LabelOnly = pa.LabelOnly.Value;
            }
            if (pa.GrandRow != null)
            {
                GrandRow = pa.GrandRow.Value;
            }
            if (pa.GrandColumn != null)
            {
                GrandColumn = pa.GrandColumn.Value;
            }
            if (pa.CacheIndex != null)
            {
                CacheIndex = pa.CacheIndex.Value;
            }
            if (pa.Outline != null)
            {
                Outline = pa.Outline.Value;
            }
            if (pa.Offset != null)
            {
                Offset = pa.Offset.Value;
            }
            if (pa.CollapsedLevelsAreSubtotals != null)
            {
                CollapsedLevelsAreSubtotals = pa.CollapsedLevelsAreSubtotals.Value;
            }
            if (pa.Axis != null)
            {
                Axis = pa.Axis.Value;
            }
            if (pa.FieldPosition != null)
            {
                FieldPosition = pa.FieldPosition.Value;
            }

            SLPivotAreaReference par;

            using (var oxr = OpenXmlReader.Create(pa))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(PivotAreaReference))
                    {
                        par = new SLPivotAreaReference();
                        par.FromPivotAreaReference((PivotAreaReference)oxr.LoadCurrentElement());
                        PivotAreaReferences.Add(par);
                    }
                }
            }
        }