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.

Reference: `text` Object

Download: input.zip | output.pptx


{
  "presentation": {
    "template": "template.pptx",
    "slides": [
      {
        "slide_index": 0,
        "shapes": [
          {
            "name": "Table 1",
            "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
                      }
                    }
                  ]
                },
                {
                  "cell_properties": {
                    "bg_color": "255,255,0"
                  },
                  "text_runs": [
                    {
                      "text_run": "",
                      "text_properties": {
                        "new_line": true
                      }
                    },
                    {
                      "text_run": "\u25B2",
                      "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": "\u25BC",
                      "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": "\u2191",
                      "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": "\u2193",
                      "text_properties": {
                        "font_color": "255,0,0",
                        "new_line": true
                      }
                    }
                  ]
                },
                "Last column"
              ]
            ]
          }
        ]
      }
    ]
  }
}

Last updated

Was this helpful?