{"record":{"id":"af6ad45c769c49e0","repo":"iOfficeAI/OfficeCLI","slug":"display-property-is-not-supported-for-excel-ole","errorCode":null,"errorMessage":"'display' property is not supported for Excel OLE (Excel always shows objects as icon). Remove --prop display.","messagePattern":"'display' property is not supported for Excel OLE \\(Excel always shows objects as icon\\)\\. Remove --prop display\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs","lineNumber":99,"sourceCode":"        // OLE payload real Excel refuses (0x800A03EC). Reject up front.\n        try\n        {\n            if (!string.IsNullOrEmpty(oleSrc) && !string.IsNullOrEmpty(_filePath)\n                && string.Equals(Path.GetFullPath(oleSrc), Path.GetFullPath(_filePath),\n                    StringComparison.OrdinalIgnoreCase))\n                throw new ArgumentException(\n                    \"Cannot embed a workbook into itself: the source file is the workbook being edited. \"\n                    + \"Embed a different file, or make a copy of the source first.\");\n        }\n        catch (ArgumentException) { throw; }\n        catch { /* path canonicalization failed — fall through to normal read */ }\n\n        // CONSISTENCY(excel-ole-display): Excel OLE does not have a\n        // DrawAspect concept — worksheet objects are always shown as\n        // icons via objectPr/anchor, so 'display' would be a no-op.\n        // Set already rejects it; Add must too, for symmetry.\n        if (properties.ContainsKey(\"display\"))\n            throw new ArgumentException(\n                \"'display' property is not supported for Excel OLE \"\n                + \"(Excel always shows objects as icon). Remove --prop display.\");\n\n        // CONSISTENCY(ole-name): Word/PPT OLE accept --prop name=... and\n        // round-trip it via Get. SpreadsheetML x:oleObject has no Name\n        // attribute in the schema, so there is nowhere to persist it.\n        // Throw explicitly rather than silently dropping the value —\n        // keep 'name' in KnownOleProps so Word/PPT still accept it.\n        if (properties.ContainsKey(\"name\"))\n            throw new ArgumentException(\n                \"'name' property is not supported for Excel OLE \"\n                + \"(Spreadsheet OleObject schema has no Name attribute). Remove --prop name.\");\n\n        // 1. Embedded payload.\n        var (oleEmbedRelId, _) = OfficeCli.Core.OleHelper.AddEmbeddedPart(oleWorksheet, oleSrc, _filePath);\n\n        // 2. Icon preview image part.\n        var (_, oleIconRelId) = OfficeCli.Core.OleHelper.CreateIconPart(oleWorksheet, properties);","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs#L81-L117","documentation":"Thrown when the 'display' property is present on an OLE-add call for Excel. Excel OLE objects are always shown as icons via objectPr/anchor — there is no DrawAspect concept — so 'display' would be a no-op. The Add handler rejects it explicitly for symmetry with the Set handler, rather than silently dropping the value.","triggerScenarios":"Calling add /Sheet1 --type ole --src obj.docx --prop display=icon (or display=content). The ContainsKey check fires regardless of the value; even display=icon is rejected because the property has no effect in the Excel OLE schema.","commonSituations":"User migrates a script from Word or PowerPoint OLE (which supports display=) to Excel and reuses the same properties. User assumes display= controls icon-vs-content rendering like in Word.","solutions":["Remove the --prop display=... argument from the OLE add call for Excel.","Excel always shows OLE objects as icons; no property controls this.","If you need display control, use Word or PowerPoint OLE instead."],"exampleFix":"// before\nadd /Sheet1 --type ole --src data.xlsx --prop display=icon\n// after\nadd /Sheet1 --type ole --src data.xlsx","handlingStrategy":"validation","validationCode":"// Remove unsupported 'display' property before Excel OLE add\nif (properties.ContainsKey(\"display\"))\n{\n    properties.Remove(\"display\");\n    Console.Error.WriteLine(\"Warning: 'display' is not supported for Excel OLE and was removed.\");\n}","typeGuard":null,"tryCatchPattern":"try { handler.AddOle(parentPath, properties); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"'display' property is not supported\"))\n{\n    properties.Remove(\"display\");\n    // retry without display\n    handler.AddOle(parentPath, properties);\n}","preventionTips":["Do not pass display= for Excel OLE objects.","Remember Excel always renders OLE as icons; no display control exists.","Strip Word/PPT-specific properties when porting scripts to Excel.","Maintain a per-application allowed-properties list."],"tags":["excel","ole","unsupported-property","display","validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}