{"record":{"id":"61e29280ffbf0da3","repo":"iOfficeAI/OfficeCLI","slug":"name-property-is-not-supported-for-excel-ole-sp","errorCode":null,"errorMessage":"'name' property is not supported for Excel OLE (Spreadsheet OleObject schema has no Name attribute). Remove --prop name.","messagePattern":"'name' property is not supported for Excel OLE \\(Spreadsheet OleObject schema has no Name attribute\\)\\. Remove --prop name\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs","lineNumber":109,"sourceCode":"        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);\n\n        // 3. Resolve ProgID.\n        var oleProgId = OfficeCli.Core.OleHelper.ResolveProgId(properties, oleSrc);\n\n        // 4. Anchor: accept either cell range \"B2:E6\" or x/y/width/height (column units).\n        // CONSISTENCY(ole-width-units): sub-cell precision is carried in\n        // ColumnOffset/RowOffset (EMU) so unit-qualified widths like\n        // \"6cm\" survive a round-trip. When the user passes a cell range\n        // or a bare integer cell count, the remainder offsets are 0 and\n        // behavior matches the legacy whole-cell path.","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs#L91-L127","documentation":"Thrown when the 'name' property is present on an Excel OLE-add call. The SpreadsheetML x:oleObject element has no Name attribute in the schema, so there is nowhere to persist a name. The property is kept in KnownOleProps (so Word/PPT still accept it) but Excel Add throws explicitly rather than silently dropping the value. This mirrors the display= rejection for consistency.","triggerScenarios":"Calling add /Sheet1 --type ole --src obj.docx --prop name=MyObject. The ContainsKey(\"name\") check fires and throws, even though the same property works for Word/PPT OLE objects.","commonSituations":"User applies a cross-application OLE property set (name, display) from Word/PPT scripts to Excel. User expects to label the OLE object for later retrieval.","solutions":["Remove the --prop name=... argument from the Excel OLE add call.","If you need to name an embedded object, use Word or PowerPoint OLE instead.","Track OLE object identity via the returned path (/Sheet1/ole[N]) instead of a name."],"exampleFix":"// before\nadd /Sheet1 --type ole --src data.xlsx --prop name=EmbeddedData\n// after\nadd /Sheet1 --type ole --src data.xlsx","handlingStrategy":"validation","validationCode":"// Remove unsupported 'name' property before Excel OLE add\nif (properties.ContainsKey(\"name\"))\n{\n    properties.Remove(\"name\");\n    Console.Error.WriteLine(\"Warning: 'name' 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(\"'name' property is not supported\"))\n{\n    properties.Remove(\"name\");\n    // retry without name\n    handler.AddOle(parentPath, properties);\n}","preventionTips":["Do not pass name= for Excel OLE objects.","Track embedded objects via the returned path (/Sheet/ole[N]), not a name.","Strip Word/PPT-specific properties when porting scripts to Excel.","Maintain a per-application allowed-properties list."],"tags":["excel","ole","unsupported-property","name","schema","validation"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}