Example #1
0
        internal void FromConditionalFormatting(X14.ConditionalFormatting cf)
        {
            this.SetAllNull();

            if (cf.Pivot != null)
            {
                this.Pivot = cf.Pivot.Value;
            }

            using (OpenXmlReader oxr = OpenXmlReader.Create(cf))
            {
                while (oxr.Read())
                {
                    SLConditionalFormattingRule2010 cfr;
                    if (oxr.ElementType == typeof(X14.ConditionalFormattingRule))
                    {
                        cfr = new SLConditionalFormattingRule2010();
                        cfr.FromConditionalFormattingRule((X14.ConditionalFormattingRule)oxr.LoadCurrentElement());
                        this.Rules.Add(cfr);
                    }
                    else if (oxr.ElementType == typeof(Excel.ReferenceSequence))
                    {
                        Excel.ReferenceSequence refseq = (Excel.ReferenceSequence)oxr.LoadCurrentElement();
                        this.ReferenceSequence = SLTool.TranslateRefSeqToCellPointRange(refseq);
                    }
                }
            }
        }
Example #2
0
        internal SLConditionalFormattingRule2010 ToSLConditionalFormattingRule2010()
        {
            SLConditionalFormattingRule2010 cfr2010 = new SLConditionalFormattingRule2010();

            cfr2010.Type              = this.Type;
            cfr2010.Priority          = this.Priority;
            cfr2010.StopIfTrue        = this.StopIfTrue;
            cfr2010.AboveAverage      = this.AboveAverage;
            cfr2010.Percent           = this.Percent;
            cfr2010.Bottom            = this.Bottom;
            cfr2010.HasOperator       = this.HasOperator;
            cfr2010.Operator          = this.Operator;
            cfr2010.Text              = this.Text;
            cfr2010.HasTimePeriod     = this.HasTimePeriod;
            cfr2010.TimePeriod        = this.TimePeriod;
            cfr2010.Rank              = this.Rank;
            cfr2010.StandardDeviation = this.StdDev;
            cfr2010.EqualAverage      = this.EqualAverage;

            foreach (Formula f in this.Formulas)
            {
                cfr2010.Formulas.Add(new Excel.Formula(f.Text));
            }
            cfr2010.HasColorScale = this.HasColorScale;
            cfr2010.ColorScale    = this.ColorScale.ToSLColorScale2010();
            cfr2010.HasDataBar    = this.HasDataBar;
            cfr2010.DataBar       = this.DataBar.ToDataBar2010();
            cfr2010.HasIconSet    = this.HasIconSet;
            cfr2010.IconSet       = this.IconSet.ToSLIconSet2010();

            cfr2010.HasDifferentialType = this.HasDifferentialFormat;
            cfr2010.DifferentialType    = this.DifferentialFormat.Clone();

            return(cfr2010);
        }
        internal SLConditionalFormattingRule2010 Clone()
        {
            SLConditionalFormattingRule2010 cfr = new SLConditionalFormattingRule2010();

            cfr.Formulas = new List <Excel.Formula>();
            for (int i = 0; i < this.Formulas.Count; ++i)
            {
                cfr.Formulas.Add((Excel.Formula) this.Formulas[i].CloneNode(true));
            }

            cfr.HasColorScale       = this.HasColorScale;
            cfr.ColorScale          = this.ColorScale.Clone();
            cfr.HasDataBar          = this.HasDataBar;
            cfr.DataBar             = this.DataBar.Clone();
            cfr.HasIconSet          = this.HasIconSet;
            cfr.IconSet             = this.IconSet.Clone();
            cfr.HasDifferentialType = this.HasDifferentialType;
            cfr.DifferentialType    = this.DifferentialType.Clone();

            cfr.Type              = this.Type;
            cfr.Priority          = this.Priority;
            cfr.StopIfTrue        = this.StopIfTrue;
            cfr.AboveAverage      = this.AboveAverage;
            cfr.Percent           = this.Percent;
            cfr.Bottom            = this.Bottom;
            cfr.HasOperator       = this.HasOperator;
            cfr.Operator          = this.Operator;
            cfr.Text              = this.Text;
            cfr.HasTimePeriod     = this.HasTimePeriod;
            cfr.TimePeriod        = this.TimePeriod;
            cfr.Rank              = this.Rank;
            cfr.StandardDeviation = this.StandardDeviation;
            cfr.EqualAverage      = this.EqualAverage;
            cfr.ActivePresent     = this.ActivePresent;
            cfr.Id = this.Id;

            return(cfr);
        }