PowerPoint Generator API
  • PowerPoint Generator API
  • Getting started
    • Quick start
  • API reference
    • token/create
    • generator/create
  • Knowledge base
    • Key concepts
    • Templating your presentation
    • Building your JSON payload
    • Finding shape names
  • JSON/ PPTX Reference
    • presentation
    • slides
    • shapes
      • textbox
      • chart
      • picture
      • table
    • tags
    • Deprecated
  • Examples
    • Presentation
      • Naming output presentation
      • Using multiple templates
    • Slide
      • Change shape size and position
      • Change shape background color
      • Hide or remove shape
      • Replacing tags
    • Textboxes
      • Add text
      • Set font type and size
      • Set font color and font background color
      • Set bold, italic & underline
      • Set text alignment
      • Set text indentation
      • Set text line spacing
      • Using bullet-points
    • Chart
      • Change font settings
      • Insert data
      • Adjust chart legend
      • Appending to data labels
    • Pictures
    • Table
      • Populate simple table
      • Using `text_runs` in Table cells
      • Handling merged cells
      • Update a specific cells in existing table
    • Tags
Powered by GitBook
On this page

Was this helpful?

  1. Examples
  2. Table

Using `text_runs` in Table cells

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

PreviousPopulate simple tableNextHandling merged cells

Last updated 10 months ago

Was this helpful?

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"
              ]
            ]
          }
        ]
      }
    ]
  }
}
74KB
text runs in cells.pptx