Text styling

  • Select the shape by name you want to modify. See here to find shape names.

  • Use the text property to define one or more text runs — each run can have its own visual properties.

  • Each text run uses the text_run field to define content, and the text_properties field to specify styling such as:

    • font_type, font_size, font_color

    • font_bold, font_italic, font_underline

    • text_align, font_bg_color, and new_line (to start a new line)

  • Use settings for general text box configuration such as line spacing, alignment, and vertical positioning.

Reference:

Download: input.zip | output.pptx


{
  "presentation": {
    "template": "template.pptx",
    "slides": [
      {
        "slide_index": 0,
        "shapes": [
          {
            "name": "TextBox 1",
            "text": [
              {
                "text_run": "Courier New ",
                "text_properties": {
                  "font_type": "Courier New",
                  "font_size": 36,
                  "font_color": "114, 225, 210"
                }
              },
              {
                "text_run": "36",
                "text_properties": {
                  "font_type": "Courier New",
                  "font_size": 36,
                  "font_color": "255, 255, 0",
                  "new_line":true 
                }
              },
              {
                "text_run": "Italic Arial ",
                "text_properties": {
                  "font_type": "Arial",
                  "font_italic": true,
                  "font_size": 48,
                  "font_color": "242, 174, 247"
                }
              },
              {
                "text_run": "28",
                "text_properties": {
                  "font_type": "Arial",
                  "font_italic": true,
                  "font_size": 28,
                  "font_color": "0, 176, 80",
                  "text_align": "right",
                  "new_line":true 
                }
              },
              {
                "text_run": "Bold Verdana ",
                "text_properties": {
                  "font_type": "Verdana",
                  "font_bold": true,
                  "font_size": 28,
                  "font_color": "241, 194, 50"
                }
              },
              {
                "text_run": "50",
                "text_properties": {
                  "font_type": "Verdana",
                  "font_bold": true,
                  "font_size": 28,
                  "font_color": "112, 48, 160",
                  "font_bg_color": "#817463",
                  "new_line":true 
                }
              },
              {
                "text_run": "Alignment right",
                "text_properties": {
                  "font_type": "Forte",
                  "font_size": 20,
                  "text_align": "right",
                  "font_color": "255, 255, 255",
                  "font_bg_color": "#817463",
                  "new_line":true 
                }
              },
              {
                "text_run": "Underline",
                "text_properties": {
                  "font_type": "Segoe Script",
                  "font_size": 36,
                  "text_align": "center",
                  "font_underline": "single",
                  "font_color": "0, 176, 240",
                  "new_line":true
                }
              },
              {
                "text_run": "Text highlight ",
                "text_properties": {
                  "font_type": "Impact",
                  "font_size": 20,
                  "text_align": "left",
                  "font_color": "orange",
                  "font_bg_color": "#00ff00"
                }
              }
            ]
          },
          {
            "name": "TextBox 2",
            "text": "First line\nSecond line\nThird line\nFourth line",
            "settings": {
              "text_line_spacing": 1.5,
              "vertical_anchor": "middle",
              "font_type": "Courier New",
              "font_size": 15,
              "font_bold": true,
              "font_italic": true,
              "text_align": "center",
              "font_color": "114, 225, 210"
            }
          }
        ]
      }
    ]
  }
}

Last updated

Was this helpful?