Esempio n. 1
0
        /// <summary>
        /// Creates a new Icon Set / Multi-State formatting
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="iconSet"></param>
        /// <returns></returns>
        public static CFRule12Record Create(HSSFSheet sheet, IconSet iconSet)
        {
            Threshold[] ts = new Threshold[iconSet.num];
            for (int i = 0; i < ts.Length; i++)
            {
                ts[i] = new IconMultiStateThreshold();
            }

            CFRule12Record r = new CFRule12Record(CONDITION_TYPE_ICON_SET,
                                                  ComparisonOperator.NO_COMPARISON);
            IconMultiStateFormatting imf = r.CreateMultiStateFormatting();

            imf.IconSet    = iconSet;
            imf.Thresholds = ts;
            return(r);
        }
Esempio n. 2
0
        public override Object Clone()
        {
            CFRule12Record rec = new CFRule12Record(ConditionType, ComparisonOperation);

            rec.futureHeader.AssociatedRange = (/*setter*/ futureHeader.AssociatedRange.Copy());

            base.CopyTo(rec);

            rec.ext_formatting_length = ext_formatting_length;
            rec.ext_formatting_data   = new byte[ext_formatting_length];
            Array.Copy(ext_formatting_data, 0, rec.ext_formatting_data, 0, ext_formatting_length);

            rec.formula_scale = formula_scale.Copy();

            rec.ext_opts              = ext_opts;
            rec.priority              = priority;
            rec.template_type         = template_type;
            rec.template_param_length = template_param_length;
            rec.template_params       = new byte[template_param_length];
            Array.Copy(template_params, 0, rec.template_params, 0, template_param_length);

            if (color_gradient != null)
            {
                rec.color_gradient = (ColorGradientFormatting)color_gradient.Clone();
            }
            if (multistate != null)
            {
                rec.multistate = (IconMultiStateFormatting)multistate.Clone();
            }
            if (data_bar != null)
            {
                rec.data_bar = (DataBarFormatting)data_bar.Clone();
            }
            if (filter_data != null)
            {
                rec.filter_data = new byte[filter_data.Length];
                Array.Copy(filter_data, 0, rec.filter_data, 0, filter_data.Length);
            }

            return(rec);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new Color Scale / Color Gradient formatting
        /// </summary>
        /// <param name="sheet"></param>
        /// <returns></returns>
        public static CFRule12Record CreateColorScale(HSSFSheet sheet)
        {
            int numPoints = 3;

            ExtendedColorR[]         colors = new ExtendedColorR[numPoints];
            ColorGradientThreshold[] ts     = new ColorGradientThreshold[numPoints];
            for (int i = 0; i < ts.Length; i++)
            {
                ts[i]     = new ColorGradientThreshold();
                colors[i] = new ExtendedColorR();
            }

            CFRule12Record r = new CFRule12Record(CONDITION_TYPE_COLOR_SCALE,
                                                  ComparisonOperator.NO_COMPARISON);
            ColorGradientFormatting cgf = r.CreateColorGradientFormatting();

            cgf.NumControlPoints = (/*setter*/ numPoints);
            cgf.Thresholds       = (/*setter*/ ts);
            cgf.Colors           = (/*setter*/ colors);
            return(r);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new Data Bar formatting
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="color"></param>
        /// <returns></returns>
        public static CFRule12Record Create(HSSFSheet sheet, ExtendedColorR color)
        {
            CFRule12Record r = new CFRule12Record(CONDITION_TYPE_DATA_BAR,
                                                  ComparisonOperator.NO_COMPARISON);
            DataBarFormatting dbf = r.CreateDataBarFormatting();

            dbf.Color      = color;
            dbf.PercentMin = (byte)0;
            dbf.PercentMax = (byte)100;

            DataBarThreshold min = new DataBarThreshold();

            min.SetType(RangeType.MIN.id);
            dbf.ThresholdMin = min;

            DataBarThreshold max = new DataBarThreshold();

            max.SetType(RangeType.MAX.id);
            dbf.ThresholdMax = max;

            return(r);
        }