protected internal String ToFormulaString(Ptg[] ParsedExpression)
 {
     if (ParsedExpression == null)
     {
         return(null);
     }
     return(HSSFConditionalFormattingRule.ToFormulaString(ParsedExpression, workbook));
 }
Beispiel #2
0
 public int AddConditionalFormatting(CellRangeAddress[] regions,
                                     HSSFConditionalFormattingRule rule1)
 {
     return(AddConditionalFormatting(regions,
                                     rule1 == null ? null : new HSSFConditionalFormattingRule[]
     {
         rule1
     }));
 }
 /// <summary>
 /// Adds the conditional formatting.
 /// </summary>
 /// <param name="regions">The regions.</param>
 /// <param name="rule1">The rule1.</param>
 /// <param name="rule2">The rule2.</param>
 /// <returns></returns>
 public int AddConditionalFormatting(CellRangeAddress[] regions,
                                     HSSFConditionalFormattingRule rule1,
                                     HSSFConditionalFormattingRule rule2)
 {
     return(AddConditionalFormatting(regions,
                                     new HSSFConditionalFormattingRule[]
     {
         rule1, rule2
     }));
 }
 /// <summary>
 /// Add a Conditional Formatting rule.
 /// Excel allows to Create up to 3 Conditional Formatting rules.
 /// </summary>
 /// <param name="cfRule">Conditional Formatting rule</param>
 public void AddRule(HSSFConditionalFormattingRule cfRule)
 {
     cfAggregate.AddRule(cfRule.CfRuleRecord);
 }
 /// <summary>
 /// Replaces an existing Conditional Formatting rule at position idx.
 /// Excel allows to Create up to 3 Conditional Formatting rules.
 /// This method can be useful to modify existing  Conditional Formatting rules.
 /// </summary>
 /// <param name="idx">position of the rule. Should be between 0 and 2.</param>
 /// <param name="cfRule">Conditional Formatting rule</param>
 public void SetRule(int idx, HSSFConditionalFormattingRule cfRule)
 {
     cfAggregate.SetRule(idx, cfRule.CfRuleRecord);
 }
        /// <summary>
        /// Allows to Add a new Conditional Formatting Set to the sheet.
        /// </summary>
        /// <param name="regions">list of rectangular regions to apply conditional formatting rules</param>
        /// <param name="cfRules">Set of up to three conditional formatting rules</param>
        /// <returns>index of the newly Created Conditional Formatting object</returns>
        public int AddConditionalFormatting(CellRangeAddress[] regions, HSSFConditionalFormattingRule[] cfRules)
        {
            if (regions == null)
            {
                throw new ArgumentException("regions must not be null");
            }
            if (cfRules == null)
            {
                throw new ArgumentException("cfRules must not be null");
            }
            if (cfRules.Length == 0)
            {
                throw new ArgumentException("cfRules must not be empty");
            }
            if (cfRules.Length > 3)
            {
                throw new ArgumentException("Number of rules must not exceed 3");
            }

            CFRuleRecord[] rules = new CFRuleRecord[cfRules.Length];
            for (int i = 0; i != cfRules.Length; i++)
            {
                rules[i] = cfRules[i].CfRuleRecord;
            }
            CFRecordsAggregate cfra = new CFRecordsAggregate(regions, rules);
            return _conditionalFormattingTable.Add(cfra);
        }
 /// <summary>
 /// Adds the conditional formatting.
 /// </summary>
 /// <param name="regions">The regions.</param>
 /// <param name="rule1">The rule1.</param>
 /// <param name="rule2">The rule2.</param>
 /// <returns></returns>
 public int AddConditionalFormatting(CellRangeAddress[] regions,
         HSSFConditionalFormattingRule rule1,
         HSSFConditionalFormattingRule rule2)
 {
     return AddConditionalFormatting(regions,
             new HSSFConditionalFormattingRule[]
         {
                 rule1, rule2
         });
 }
 /// <summary>
 /// Add a Conditional Formatting rule.
 /// Excel allows to Create up to 3 Conditional Formatting rules.
 /// </summary>
 /// <param name="cfRule">Conditional Formatting rule</param>
 public void AddRule(HSSFConditionalFormattingRule cfRule)
 {
     cfAggregate.AddRule(cfRule.CfRuleRecord);
 }
 /// <summary>
 /// Replaces an existing Conditional Formatting rule at position idx.
 /// Excel allows to Create up to 3 Conditional Formatting rules.
 /// This method can be useful to modify existing  Conditional Formatting rules.
 /// </summary>
 /// <param name="idx">position of the rule. Should be between 0 and 2.</param>
 /// <param name="cfRule">Conditional Formatting rule</param>
 public void SetRule(int idx, HSSFConditionalFormattingRule cfRule)
 {
     cfAggregate.SetRule(idx, cfRule.CfRuleRecord);
 }
        public int AddConditionalFormatting(CellRangeAddress[] regions,
            HSSFConditionalFormattingRule rule1)
        {
            return AddConditionalFormatting(regions,
                    rule1 == null ? null : new HSSFConditionalFormattingRule[]
				{
					rule1
				});
        }