Skip to main content
Alpha: Document API is currently alpha and subject to breaking changes.

Summary

  • Operation ID: styles.apply
  • API member path: editor.doc.styles.apply(...)
  • Mutates document: yes
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: yes
  • Deterministic target resolution: yes

Input fields

No fields.

Example request

{
  "patch": {
    "bold": true,
    "italic": true
  },
  "target": {
    "channel": "run",
    "scope": "docDefaults"
  }
}

Output fields

No fields.

Example response

{
  "after": {
    "bold": "on",
    "italic": "on"
  },
  "before": {
    "bold": "on",
    "italic": "on"
  },
  "changed": true,
  "dryRun": true,
  "resolution": {
    "channel": "run",
    "scope": "docDefaults",
    "xmlPart": "word/styles.xml",
    "xmlPath": "w:styles/w:docDefaults/w:rPrDefault/w:rPr"
  },
  "success": true
}

Pre-apply throws

  • INVALID_TARGET
  • INVALID_INPUT
  • CAPABILITY_UNAVAILABLE
  • REVISION_MISMATCH

Non-applied failure codes

  • None

Raw schemas

{
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "patch": {
          "additionalProperties": false,
          "minProperties": 1,
          "properties": {
            "bold": {
              "type": "boolean"
            },
            "color": {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "themeColor": {
                  "type": "string"
                },
                "themeShade": {
                  "type": "string"
                },
                "themeTint": {
                  "type": "string"
                },
                "val": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            "fontFamily": {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "ascii": {
                  "type": "string"
                },
                "asciiTheme": {
                  "type": "string"
                },
                "cs": {
                  "type": "string"
                },
                "cstheme": {
                  "type": "string"
                },
                "eastAsia": {
                  "type": "string"
                },
                "eastAsiaTheme": {
                  "type": "string"
                },
                "hAnsi": {
                  "type": "string"
                },
                "hAnsiTheme": {
                  "type": "string"
                },
                "hint": {
                  "type": "string"
                },
                "val": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            "fontSize": {
              "type": "integer"
            },
            "fontSizeCs": {
              "type": "integer"
            },
            "italic": {
              "type": "boolean"
            },
            "letterSpacing": {
              "type": "integer"
            }
          },
          "type": "object"
        },
        "target": {
          "additionalProperties": false,
          "properties": {
            "channel": {
              "const": "run"
            },
            "scope": {
              "const": "docDefaults"
            }
          },
          "required": [
            "scope",
            "channel"
          ],
          "type": "object"
        }
      },
      "required": [
        "target",
        "patch"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "patch": {
          "additionalProperties": false,
          "minProperties": 1,
          "properties": {
            "indent": {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "end": {
                  "type": "integer"
                },
                "endChars": {
                  "type": "integer"
                },
                "firstLine": {
                  "type": "integer"
                },
                "firstLineChars": {
                  "type": "integer"
                },
                "hanging": {
                  "type": "integer"
                },
                "hangingChars": {
                  "type": "integer"
                },
                "left": {
                  "type": "integer"
                },
                "leftChars": {
                  "type": "integer"
                },
                "right": {
                  "type": "integer"
                },
                "rightChars": {
                  "type": "integer"
                },
                "start": {
                  "type": "integer"
                },
                "startChars": {
                  "type": "integer"
                }
              },
              "type": "object"
            },
            "justification": {
              "enum": [
                "left",
                "center",
                "right",
                "justify",
                "distribute"
              ]
            },
            "spacing": {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "after": {
                  "type": "integer"
                },
                "afterAutospacing": {
                  "type": "boolean"
                },
                "afterLines": {
                  "type": "integer"
                },
                "before": {
                  "type": "integer"
                },
                "beforeAutospacing": {
                  "type": "boolean"
                },
                "beforeLines": {
                  "type": "integer"
                },
                "line": {
                  "type": "integer"
                },
                "lineRule": {
                  "enum": [
                    "auto",
                    "exact",
                    "atLeast"
                  ]
                }
              },
              "type": "object"
            }
          },
          "type": "object"
        },
        "target": {
          "additionalProperties": false,
          "properties": {
            "channel": {
              "const": "paragraph"
            },
            "scope": {
              "const": "docDefaults"
            }
          },
          "required": [
            "scope",
            "channel"
          ],
          "type": "object"
        }
      },
      "required": [
        "target",
        "patch"
      ],
      "type": "object"
    }
  ]
}
{
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "after": {
          "additionalProperties": false,
          "properties": {
            "bold": {
              "enum": [
                "on",
                "off",
                "inherit"
              ]
            },
            "color": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "fontFamily": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "fontSize": {
              "oneOf": [
                {
                  "type": "number"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "fontSizeCs": {
              "oneOf": [
                {
                  "type": "number"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "indent": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "italic": {
              "enum": [
                "on",
                "off",
                "inherit"
              ]
            },
            "justification": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "letterSpacing": {
              "oneOf": [
                {
                  "type": "number"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "spacing": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            }
          },
          "type": "object"
        },
        "before": {
          "additionalProperties": false,
          "properties": {
            "bold": {
              "enum": [
                "on",
                "off",
                "inherit"
              ]
            },
            "color": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "fontFamily": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "fontSize": {
              "oneOf": [
                {
                  "type": "number"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "fontSizeCs": {
              "oneOf": [
                {
                  "type": "number"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "indent": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "italic": {
              "enum": [
                "on",
                "off",
                "inherit"
              ]
            },
            "justification": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "letterSpacing": {
              "oneOf": [
                {
                  "type": "number"
                },
                {
                  "const": "inherit"
                }
              ]
            },
            "spacing": {
              "oneOf": [
                {
                  "type": "object"
                },
                {
                  "const": "inherit"
                }
              ]
            }
          },
          "type": "object"
        },
        "changed": {
          "type": "boolean"
        },
        "dryRun": {
          "type": "boolean"
        },
        "resolution": {
          "additionalProperties": false,
          "properties": {
            "channel": {
              "enum": [
                "run",
                "paragraph"
              ]
            },
            "scope": {
              "const": "docDefaults"
            },
            "xmlPart": {
              "const": "word/styles.xml"
            },
            "xmlPath": {
              "enum": [
                "w:styles/w:docDefaults/w:rPrDefault/w:rPr",
                "w:styles/w:docDefaults/w:pPrDefault/w:pPr"
              ]
            }
          },
          "required": [
            "scope",
            "channel",
            "xmlPart",
            "xmlPath"
          ],
          "type": "object"
        },
        "success": {
          "const": true
        }
      },
      "required": [
        "success",
        "changed",
        "resolution",
        "dryRun",
        "before",
        "after"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "failure": {
          "additionalProperties": false,
          "properties": {
            "code": {
              "type": "string"
            },
            "details": {},
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object"
        },
        "resolution": {
          "additionalProperties": false,
          "properties": {
            "channel": {
              "enum": [
                "run",
                "paragraph"
              ]
            },
            "scope": {
              "const": "docDefaults"
            },
            "xmlPart": {
              "const": "word/styles.xml"
            },
            "xmlPath": {
              "enum": [
                "w:styles/w:docDefaults/w:rPrDefault/w:rPr",
                "w:styles/w:docDefaults/w:pPrDefault/w:pPr"
              ]
            }
          },
          "required": [
            "scope",
            "channel",
            "xmlPart",
            "xmlPath"
          ],
          "type": "object"
        },
        "success": {
          "const": false
        }
      },
      "required": [
        "success",
        "resolution",
        "failure"
      ],
      "type": "object"
    }
  ]
}
{
  "additionalProperties": false,
  "properties": {
    "after": {
      "additionalProperties": false,
      "properties": {
        "bold": {
          "enum": [
            "on",
            "off",
            "inherit"
          ]
        },
        "color": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "fontFamily": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "fontSize": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "fontSizeCs": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "indent": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "italic": {
          "enum": [
            "on",
            "off",
            "inherit"
          ]
        },
        "justification": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "letterSpacing": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "spacing": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        }
      },
      "type": "object"
    },
    "before": {
      "additionalProperties": false,
      "properties": {
        "bold": {
          "enum": [
            "on",
            "off",
            "inherit"
          ]
        },
        "color": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "fontFamily": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "fontSize": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "fontSizeCs": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "indent": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "italic": {
          "enum": [
            "on",
            "off",
            "inherit"
          ]
        },
        "justification": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "letterSpacing": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "const": "inherit"
            }
          ]
        },
        "spacing": {
          "oneOf": [
            {
              "type": "object"
            },
            {
              "const": "inherit"
            }
          ]
        }
      },
      "type": "object"
    },
    "changed": {
      "type": "boolean"
    },
    "dryRun": {
      "type": "boolean"
    },
    "resolution": {
      "additionalProperties": false,
      "properties": {
        "channel": {
          "enum": [
            "run",
            "paragraph"
          ]
        },
        "scope": {
          "const": "docDefaults"
        },
        "xmlPart": {
          "const": "word/styles.xml"
        },
        "xmlPath": {
          "enum": [
            "w:styles/w:docDefaults/w:rPrDefault/w:rPr",
            "w:styles/w:docDefaults/w:pPrDefault/w:pPr"
          ]
        }
      },
      "required": [
        "scope",
        "channel",
        "xmlPart",
        "xmlPath"
      ],
      "type": "object"
    },
    "success": {
      "const": true
    }
  },
  "required": [
    "success",
    "changed",
    "resolution",
    "dryRun",
    "before",
    "after"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "failure": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "details": {},
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "resolution": {
      "additionalProperties": false,
      "properties": {
        "channel": {
          "enum": [
            "run",
            "paragraph"
          ]
        },
        "scope": {
          "const": "docDefaults"
        },
        "xmlPart": {
          "const": "word/styles.xml"
        },
        "xmlPath": {
          "enum": [
            "w:styles/w:docDefaults/w:rPrDefault/w:rPr",
            "w:styles/w:docDefaults/w:pPrDefault/w:pPr"
          ]
        }
      },
      "required": [
        "scope",
        "channel",
        "xmlPart",
        "xmlPath"
      ],
      "type": "object"
    },
    "success": {
      "const": false
    }
  },
  "required": [
    "success",
    "resolution",
    "failure"
  ],
  "type": "object"
}