Open Presentation

Search docs

Loading documentation…
    OpenPresentation/opf
    Browse docs
    On this page
    View source

    Number Format

    Number display pattern, shared by NumberVariable.format, data column formats (DataColumn.format) and table cell formats (StyledTableCell.format). An optional literal prefix, a numeric part of '#', '0', ',' and '.', and an optional literal suffix. '0' pads digits, '#' is optional, ',' groups thousands, digits after '.' fix the decimals ('0' required, '#' optional), and a '%' in the prefix or suffix multiplies the value by 100. English separators only. A format is one to three ';'-separated sections, positive;negative;zero, each such a pattern: with two, the second formats negative numbers, with three the third formats zero. A negative section formats the absolute value and prints no minus of its own, so '+0%;-0%' shows +12% and -5%. More than three sections, an empty section or a section without a numeric part is a 'number-format-invalid' error; there is no text section, color or condition. A format applies only to number values; strings, booleans, null and rich runs display unchanged. A column or cell format that is not a valid pattern is a 'number-format-invalid' error. The PPTX export writes it as the equivalent Excel number format code.

    Metadata

    Definition
    #/$defs/NumberFormat
    Form
    string
    Source
    spec/schemas/opf.schema.json

    Field index

    This definition uses the forms or value constraints below.

    Complete definition constraints
    Schema constraints
    {
      "type": "string",
      "description": "Number display pattern, shared by NumberVariable.format, data column formats (DataColumn.format) and table cell formats (StyledTableCell.format). An optional literal prefix, a numeric part of '#', '0', ',' and '.', and an optional literal suffix. '0' pads digits, '#' is optional, ',' groups thousands, digits after '.' fix the decimals ('0' required, '#' optional), and a '%' in the prefix or suffix multiplies the value by 100. English separators only. A format is one to three ';'-separated sections, positive;negative;zero, each such a pattern: with two, the second formats negative numbers, with three the third formats zero. A negative section formats the absolute value and prints no minus of its own, so '+0%;-0%' shows +12% and -5%. More than three sections, an empty section or a section without a numeric part is a 'number-format-invalid' error; there is no text section, color or condition. A format applies only to number values; strings, booleans, null and rich runs display unchanged. A column or cell format that is not a valid pattern is a 'number-format-invalid' error. The PPTX export writes it as the equivalent Excel number format code.",
      "examples": [
        "#,##0",
        "0.0",
        "$#,##0.00",
        "0.#%",
        "0%",
        "#,##0.0M",
        "#,##0 units"
      ]
    }