예제 #1
0
        public ColorGradientFormatting CreateColorGradientFormatting()
        {
            if (color_gradient != null)
            {
                return(color_gradient);
            }

            // Convert, Setup and return
            ConditionType  = (CONDITION_TYPE_COLOR_SCALE);
            color_gradient = new ColorGradientFormatting();
            return(color_gradient);
        }
예제 #2
0
        private HSSFColorScaleFormatting GetColorScaleFormatting(bool create)
        {
            CFRule12Record          cfRule12Record  = GetCFRule12Record(create);
            ColorGradientFormatting colorFormatting = cfRule12Record.ColorGradientFormatting;

            if (colorFormatting != null)
            {
                return(new HSSFColorScaleFormatting(cfRule12Record, sheet));
            }
            else if (create)
            {
                colorFormatting = cfRule12Record.CreateColorGradientFormatting();
                return(new HSSFColorScaleFormatting(cfRule12Record, sheet));
            }
            else
            {
                return(null);
            }
        }
예제 #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);
        }
예제 #4
0
 protected internal HSSFColorScaleFormatting(CFRule12Record cfRule12Record, HSSFSheet sheet)
 {
     this.sheet           = sheet;
     this.cfRule12Record  = cfRule12Record;
     this.colorFormatting = this.cfRule12Record.ColorGradientFormatting;
 }
예제 #5
0
        public CFRule12Record(RecordInputStream in1)
        {
            futureHeader        = new FtrHeader(in1);
            ConditionType       = ((byte)in1.ReadByte());
            ComparisonOperation = ((byte)in1.ReadByte());
            int field_3_formula1_len = in1.ReadUShort();
            int field_4_formula2_len = in1.ReadUShort();

            ext_formatting_length = in1.ReadInt();
            ext_formatting_data   = new byte[0];
            if (ext_formatting_length == 0)
            {
                // 2 bytes reserved
                in1.ReadUShort();
            }
            else
            {
                int len = ReadFormatOptions(in1);
                if (len < ext_formatting_length)
                {
                    ext_formatting_data = new byte[ext_formatting_length - len];
                    in1.ReadFully(ext_formatting_data);
                }
            }

            Formula1 = (Formula.Read(field_3_formula1_len, in1));
            Formula2 = (Formula.Read(field_4_formula2_len, in1));

            int formula_scale_len = in1.ReadUShort();

            formula_scale = Formula.Read(formula_scale_len, in1);

            ext_opts              = (byte)in1.ReadByte();
            priority              = in1.ReadUShort();
            template_type         = in1.ReadUShort();
            template_param_length = (byte)in1.ReadByte();
            if (template_param_length == 0 || template_param_length == 16)
            {
                template_params = new byte[template_param_length];
                in1.ReadFully(template_params);
            }
            else
            {
                //logger.Log(POILogger.WARN, "CF Rule v12 template params length should be 0 or 16, found " + template_param_length);
                in1.ReadRemainder();
            }

            byte type = ConditionType;

            if (type == CONDITION_TYPE_COLOR_SCALE)
            {
                color_gradient = new ColorGradientFormatting(in1);
            }
            else if (type == CONDITION_TYPE_DATA_BAR)
            {
                data_bar = new DataBarFormatting(in1);
            }
            else if (type == CONDITION_TYPE_FILTER)
            {
                filter_data = in1.ReadRemainder();
            }
            else if (type == CONDITION_TYPE_ICON_SET)
            {
                multistate = new IconMultiStateFormatting(in1);
            }
        }