Office customui xsd
Reference for the Office CustomUI XML schema used to define Excel ribbon toolbars and context menus. Use this skill whenever writing, editing, reviewing, or debugging customUI XML — including ribbon tabs, groups, buttons, dropdowns, galleries, menus, context menus, the QAT, or the Backstage. Also use when working with PyXLL ribbon configuration. Training-data knowledge of the schema is incomplete and can produce invalid XML — the schema and these docs are the authoritative source.From its SKILL.md
npx -y skills add pyxll/pyxll-agent-skills --skill office-customui-xsdAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.0 KB, as published. Nobody here has run it
Office CustomUI XML Reference Skill
How to use this skill
-
Read
resources/index.md— find which reference file covers your task, and check the allowed-controls table before placing any control (not all controls are valid in all locations). -
Read the relevant doc(s):
resources/document-structure.md— root element, namespace, overall XML skeletonresources/ribbon.md— tabs, groups, QAT, contextual tabs, PyXLL merge rulesresources/controls.md— all controls for ribbon groups and menusresources/context-menus.md— context menu structure and allowed controlsresources/attributes.md— complete attribute reference (label, image, callbacks, etc.)resources/backstage.md— File menu (Backstage) customisation
-
If you cannot find what you need in the markdown docs, read the raw XSD:
resources/office-customui-2009-07.xsd. Never guess — invalid attributes are silently ignored and invalid nesting causes load errors. -
Validate the XML before deploying. Run it through
xmllintusing the bundled XSD. The XSD is at<SKILL_BASE_DIR>/resources/office-customui-2009-07.xsd— replace<SKILL_BASE_DIR>with the actual base directory path provided when this skill is loaded.xmllint --noout --schema <SKILL_BASE_DIR>/resources/office-customui-2009-07.xsd ribbon.xmlOr with Python's lxml:
etree.XMLSchema(etree.parse('<SKILL_BASE_DIR>/resources/office-customui-2009-07.xsd')).assertValid(etree.parse('ribbon.xml'))PyXLL caveat:
insertBefore/insertAfterare PyXLL-only merge attributes not in the schema, so they produce expected validation errors. Strip them before validating, or treat those specific attribute errors as false positives.
Rules for AI Agents
These rules are mandatory. Follow them before writing any customUI XML.
-
Callbacks are
module.functionstrings — e.g."my_module.on_button_click". AllonAction,getLabel,getEnabled, etc. attributes require this format. The module must be importable from the Python path. -
IDs must be unique across the entire XML file. Reusing an
idanywhere in the file is a schema error. -
Image attributes are mutually exclusive. Specify only one of
image,imageMso, orgetImageon any control — not multiple. -
Positioning attributes are mutually exclusive. Use only one of
insertAfterMso,insertBeforeMso,insertAfterQ,insertBeforeQper control. -
When working with PyXLL, always invoke the
fetch-pyxll-docsskill before writing or modifying any ribbon or context menu code. This schema skill covers the XML structure; the PyXLL docs cover how the XML file is configured (pyxll.cfgribbonkey), how callback functions are resolved, theIRibbonUI/IRibbonControlPython API, and PyXLL-specific behaviour such as ribbon merging andpyxll.load_image. Both skills are needed together for correct PyXLL ribbon work.
Minimal valid skeleton
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
onLoad="my_ribbon.on_load"
loadImage="pyxll.load_image">
<ribbon>
<tabs>
<tab id="myTab" label="My Add-in" insertAfterMso="TabHome">
<group id="myGroup" label="Tools">
<button id="myButton"
label="Run"
imageMso="RunMacro"
size="large"
screentip="Run"
supertip="Run the selected analysis."
onAction="my_ribbon.on_run"/>
</group>
</tab>
</tabs>
</ribbon>
<contextMenus>
<contextMenu idMso="ContextMenuCell">
<button id="myCellAction"
label="My Cell Action"
imageMso="RunMacro"
onAction="my_ribbon.on_cell_action"/>
</contextMenu>
</contextMenus>
</customUI>
Note: contextMenus must come after ribbon; size="large" is only valid on buttons inside ribbon groups.
Trigger conditions
Invoke this skill automatically (without being asked) whenever writing, editing, reviewing, or debugging customUI XML — ribbon tabs, groups, controls, context menus, QAT, or Backstage. Also invoke for any ribbon callback function or PyXLL ribbon config.
Non-obvious triggers:
- XML using the older
http://schemas.microsoft.com/office/2006/01/customuinamespace - The user mentions Office UI Extensibility or RibbonX