{"record":{"id":"d01ecf353c55e186","repo":"iOfficeAI/OfficeCLI","slug":"cellis-conditional-formatting-requires-value-pro","errorCode":null,"errorMessage":"cellIs conditional formatting requires 'value' property (e.g. value=50).","messagePattern":"cellIs conditional formatting requires 'value' property \\(e\\.g\\. value=50\\)\\.","errorType":"validation","errorClass":"System.ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs","lineNumber":546,"sourceCode":"        var opStr = (properties.GetValueOrDefault(\"operator\") ?? \"greaterThan\").Trim();\n        var opVal = opStr.ToLowerInvariant() switch\n        {\n            \"greaterthan\" or \"gt\" or \">\" => ConditionalFormattingOperatorValues.GreaterThan,\n            \"lessthan\" or \"lt\" or \"<\" => ConditionalFormattingOperatorValues.LessThan,\n            \"greaterthanorequal\" or \"gte\" or \">=\" => ConditionalFormattingOperatorValues.GreaterThanOrEqual,\n            \"lessthanorequal\" or \"lte\" or \"<=\" => ConditionalFormattingOperatorValues.LessThanOrEqual,\n            \"equal\" or \"eq\" or \"=\" or \"==\" => ConditionalFormattingOperatorValues.Equal,\n            \"notequal\" or \"ne\" or \"!=\" or \"<>\" => ConditionalFormattingOperatorValues.NotEqual,\n            \"between\" => ConditionalFormattingOperatorValues.Between,\n            \"notbetween\" => ConditionalFormattingOperatorValues.NotBetween,\n            _ => throw new ArgumentException(\n                $\"Unsupported cellIs operator '{opStr}'. Valid: greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual, equal, notEqual, between, notBetween.\")\n        };\n\n        var primary = properties.GetValueOrDefault(\"value\")\n            ?? properties.GetValueOrDefault(\"formula\")\n            ?? properties.GetValueOrDefault(\"value1\")\n            ?? throw new ArgumentException(\"cellIs conditional formatting requires 'value' property (e.g. value=50).\");\n        var secondary = properties.GetValueOrDefault(\"value2\")\n            ?? properties.GetValueOrDefault(\"formula2\")\n            ?? properties.GetValueOrDefault(\"maxvalue\");\n\n        if ((opVal == ConditionalFormattingOperatorValues.Between\n             || opVal == ConditionalFormattingOperatorValues.NotBetween)\n            && secondary == null)\n        {\n            throw new ArgumentException(\n                $\"cellIs operator '{opStr}' requires 'value2' property (e.g. value=10 value2=50).\");\n        }\n\n        // cellIs value/value2 land in <x:formula> (A1-only). Reject R1C1-style\n        // refs so the file doesn't silently become one Excel refuses to open.\n        ValidateNoR1C1Reference(primary);\n        if (secondary != null) ValidateNoR1C1Reference(secondary);\n\n        // Build DifferentialFormat (dxf)","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs#L528-L564","documentation":"Thrown by AddCellIs when none of the accepted property keys supply the primary comparison value. The builder checks 'value', then 'formula', then 'value1'. A cellIs cfRule requires at least one <x:formula> child carrying the comparison operand; without it the rule has nothing to compare each cell against.","triggerScenarios":"Calling Add with type=cellis and an operator, but omitting all of value, formula, and value1. Example: add /Sheet1/A1:A10 cellis operator=greaterThan (no value).","commonSituations":"User expects the value to come from a referenced cell; misspelled key (values= instead of value=); assumed the operator alone is sufficient.","solutions":["Supply the comparison literal via 'value' (e.g. value=50).","Aliases 'formula' and 'value1' are also accepted.","The value must be A1-style (R1C1 refs are rejected separately by ValidateNoR1C1Reference)."],"exampleFix":"// before: no value\nadd /Sheet1/A1:A10 cellis operator=greaterThan fill=FF0000\n// after\nadd /Sheet1/A1:A10 cellis operator=greaterThan value=100 fill=FF0000","handlingStrategy":"validation","validationCode":"if (!properties.ContainsKey(\"value\") && !properties.ContainsKey(\"formula\") && !properties.ContainsKey(\"value1\"))\n    throw new ArgumentException(\"cellIs requires 'value' (aliases: formula, value1).\");","typeGuard":"static bool HasCellIsValue(IReadOnlyDictionary<string,string> p)\n    => p.ContainsKey(\"value\") || p.ContainsKey(\"formula\") || p.ContainsKey(\"value1\");","tryCatchPattern":"try { return Add(path, \"cellis\", pos, props); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"requires 'value'\"))\n{ /* prompt for value, retry */ throw; }","preventionTips":["Always supply 'value' for cellIs rules.","formula and value1 are accepted aliases.","Use A1-style literals/refs (R1C1 rejected separately)."],"tags":["excel","conditional-formatting","cellis","required-property","argument-validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}