Example #1
0
        public DataBarFormatting CreateDataBarFormatting()
        {
            if (data_bar != null)
            {
                return(data_bar);
            }

            // Convert, Setup and return
            ConditionType = (CONDITION_TYPE_DATA_BAR);
            data_bar      = new DataBarFormatting();
            return(data_bar);
        }
        private HSSFDataBarFormatting GetDataBarFormatting(bool create)
        {
            CFRule12Record    cfRule12Record    = GetCFRule12Record(create);
            DataBarFormatting databarFormatting = cfRule12Record.DataBarFormatting;

            if (databarFormatting != null)
            {
                return(new HSSFDataBarFormatting(cfRule12Record, sheet));
            }
            else if (create)
            {
                databarFormatting = cfRule12Record.CreateDataBarFormatting();
                return(new HSSFDataBarFormatting(cfRule12Record, sheet));
            }
            else
            {
                return(null);
            }
        }
Example #3
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);
        }
Example #4
0
 protected internal HSSFDataBarFormatting(CFRule12Record cfRule12Record, HSSFSheet sheet)
 {
     this.sheet             = sheet;
     this.cfRule12Record    = cfRule12Record;
     this.databarFormatting = this.cfRule12Record.DataBarFormatting;
 }
Example #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);
            }
        }