Using `text_runs` in Table cells

Use text runs to apply different font settings to different strings in the same cell.

To set the styling of specific chunks of string in a cell, you will need to pass a list of text_run objects to define each piece of text.

Before and after

Template Presentation

JSON Payload

{
  "presentation": {
    "template": "text runs in cells.pptx",
    "export_version": "Pptx2010",
    "slides": [
      {
        "type": "slide",
        "slide_index": 0,
        "shapes": [
          {
            "name": "Table 2",
            "data_cells": [
              [
                "",
                {
                  "cell_properties": {
                    "bg_color": "0,128,0"
                  },
                  "text_runs": [
                    {
                      "text_run": "Simple cell value in cell"
                    }
                  ]
                },
                "*Number is set to black, Unicode arrow is green",
                "*Red arrow is left of number.  Green arrow is right of number",
                "*Arrows are above and below number",
                "*Arrows are above, below, left and right of number"
              ],
              [
                "Examples:",
                76,
                {
                  "cell_properties": {
                    "bg_color": "0,128,0"
                  },
                  "text_runs": [
                    {
                      "text_run": "12.0 ",
                      "text_properties": {
                        "font_type": "Comic Sans MS",
                        "font_size": 24,
                        "font_bold": true,
                        "font_italic": true,
                        "font_underline": "single",
                        "font_color": "0,0,0",
                        "font_bg_color": "255,165,0",
                        "text_align": "right",
                        "text_indent": 1,
                        "text_line_spacing": 4.2,
                        "new_line": true
                      }
                    },
                    {
                      "text_run": "▼",
                      "text_properties": {
                        "font_color": "0,0,0",
                        "new_line": false
                      }
                    }
                  ]
                },
                {
                  "cell_properties": {
                    "bg_color": "255,255,0"
                  },
                  "text_runs": [
                    {
                      "text_run": "",
                      "text_properties": {
                        "new_line": true
                      }
                    },
                    {
                      "text_run": "▲",
                      "text_properties": {
                        "font_color": "255,0,0",
                        "new_line": true
                      }
                    },
                    {
                      "text_run": " 14.0 ",
                      "text_properties": {
                        "font_color": "0,0,0",
                        "font_bold": false,
                        "new_line": false
                      }
                    },
                    {
                      "text_run": "▼",
                      "text_properties": {
                        "font_color": "0,128,0",
                        "new_line": false
                      }
                    },
                    {
                      "text_run": "",
                      "text_properties": {
                        "new_line": true
                      }
                    }
                  ]
                },
                {
                  "cell_properties": {
                    "bg_color": "0,128,0"
                  },
                  "text_runs": [
                    {
                      "text_run": "↑",
                      "text_properties": {
                        "font_color": "128,0,128",
                        "new_line": true
                      }
                    },
                    {
                      "text_run": "7.0",
                      "text_properties": {
                        "font_color": "0,0,0",
                        "font_bold": false,
                        "new_line": true
                      }
                    },
                    {
                      "text_run": "↓",
                      "text_properties": {
                        "font_color": "255,0,0",
                        "new_line": true
                      }
                    }
                  ]
                },
                "Last column"
              ]
            ]
          }
        ]
      }
    ]
  }
}

Last updated