mirror of
https://github.com/iOfficeAI/OfficeCLI
synced 2026-04-21 13:37:23 +00:00
fix(xlsx): wire aboveAverage stdDev=/equalAverage= on CF rule
conditional formatting rule=aboveAverage previously silently dropped the stdDev= and equalAverage= properties. Both now flow onto the cfRule attributes: stdDev=N (integer deviations from mean) and equalAverage=true (include values equal to the mean). Also accepted the aboveaverage= spelling as an alias for above= to mirror the OOXML attribute name.
This commit is contained in:
parent
14171d018d
commit
8b58e2acb8
1 changed files with 22 additions and 2 deletions
|
|
@ -3267,13 +3267,33 @@ public partial class ExcelHandler
|
|||
}
|
||||
case "aboveaverage":
|
||||
{
|
||||
var aboveBelow = properties.GetValueOrDefault("above", "true");
|
||||
cfNewRule = new ConditionalFormattingRule
|
||||
// `above=` is the legacy spelling; `aboveaverage=false`
|
||||
// (matching the cfType name) is accepted as an alias
|
||||
// so users can mirror the OOXML attribute.
|
||||
var aboveBelow = properties.GetValueOrDefault("above",
|
||||
properties.GetValueOrDefault("aboveaverage", "true"));
|
||||
var aboveRule = new ConditionalFormattingRule
|
||||
{
|
||||
Type = ConditionalFormatValues.AboveAverage,
|
||||
Priority = cfNewPriority,
|
||||
AboveAverage = ParseHelpers.IsTruthy(aboveBelow) ? null : false
|
||||
};
|
||||
// R15-3: wire stdDev= (deviations above/below mean)
|
||||
// and equalAverage= (include values equal to the mean)
|
||||
// onto the cfRule.
|
||||
if (properties.TryGetValue("stdDev", out var stdDevRaw)
|
||||
&& !string.IsNullOrWhiteSpace(stdDevRaw)
|
||||
&& int.TryParse(stdDevRaw, out var stdDevVal))
|
||||
{
|
||||
aboveRule.StdDev = stdDevVal;
|
||||
}
|
||||
if (properties.TryGetValue("equalAverage", out var eqAvgRaw)
|
||||
&& !string.IsNullOrWhiteSpace(eqAvgRaw)
|
||||
&& ParseHelpers.IsTruthy(eqAvgRaw))
|
||||
{
|
||||
aboveRule.EqualAverage = true;
|
||||
}
|
||||
cfNewRule = aboveRule;
|
||||
break;
|
||||
}
|
||||
case "uniquevalues":
|
||||
|
|
|
|||
Loading…
Reference in a new issue