formula_scale = Formula.create(ptgs);
}
+ public int getPriority() {
+ return priority;
+ }
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
public short getSid() {
return sid;
}
}
/**
- * we don't know priority for these, other than definition/model order, which appears to be what Excel uses.
+ * Only newer style formatting rules have priorities. For older ones,
+ * we don't know priority for these, other than definition/model order,
+ * which appears to be what Excel uses.
* @see org.apache.poi.ss.usermodel.ConditionalFormattingRule#getPriority()
*/
public int getPriority() {
- return 0;
+ CFRule12Record rule12 = getCFRule12Record(false);
+ if (rule12 == null) return 0;
+ return rule12.getPriority();
}
/**
String getFormula2();
/**
- * HSSF just returns 0, XSSF uses the value stored in the model if present,
- * otherwise uses 0.
+ * The priority of the rule, if defined, otherwise 0.
* <p/>
- * If priority is 0, just use definition order, as that's how HSSF rules are evaluated.
+ * If priority is 0, just use definition order, as that's how older HSSF rules
+ * are evaluated.
+ * <p/>
+ * For XSSF, this should always be set. For HSSF, only newer style rules
+ * have this set, older ones will return 0.
* <p/>
* If a rule is created but not yet added to a sheet, this value may not be valid.
* @return rule priority