Пример #1
0
        internal SLPivotAreaReference Clone()
        {
            SLPivotAreaReference par = new SLPivotAreaReference();

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

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

            return(par);
        }
        internal void FromPivotArea(PivotArea pa)
        {
            this.SetAllNull();

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

            SLPivotAreaReference par;

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