addTextBox

addTextBox

BASIC / ADVANCED / PREMIUM

Inserts a text box into the PowerPoint presentation.

Description
public addTextBox($position, $textBoxStyles = array(), $options = array())

This method inserts text boxes into the PowerPoint presentation.

Parameters

position

Text box position.

Key Type Description
coordinateX int EMUs (English Metric Unit).
coordinateY int EMUs (English Metric Unit).
sizeX int EMUs (English Metric Unit).
sizeY int EMUs (English Metric Unit).
name string Internal name. If not set, a random name is generated.
order int Set the display order. Default after existing contents. 0 is the first order position. If the order position doesn't exist add after existing contents.

Coordinate and size values must be set.

textBoxStyles

Key Type Description
autofit string autofit (default), noautofit, shrink.
border array
  • 'cap' (string) rnd, sq, flat.
  • 'dash' (string) solid, dot, dash, lgDash, dashDot, lgDashDot, lgDashDotDot, sysDash, sysDot, sysDashDot, sysDashDotDot.
  • 'color' (string) default as 000000.
  • 'transparency' (int) 0 to 100.
  • 'width' (int) EMUs (English Metric Unit). Default as 12700 (1pt).
columns array
  • 'number' (int)
  • 'spacing' (int) EMUs (English Metric Unit).
descr string Descr value.
fill array
  • 'color' (string) FFFF00, CCCCCC...
  • 'image' (string)
  • 'imageAsTexture' (bool) default as false
  • 'transparency' (int) 0 to 100.
margin array
  • 'bottom' (int) EMUs (English Metric Unit)
  • 'left' (int) EMUs (English Metric Unit)
  • 'right' (int) EMUs (English Metric Unit)
  • 'top' (int) EMUs (English Metric Unit)
rotation int 60.000ths of a degree.
textDirection string horz, vert, vert270, wordArtVert, eaVert, mongolianVert, wordArtVertRtl.
verticalAlign string top, middle, bottom, topCentered, middleCentered, bottomCentered.
wrap string square, none.

Theme options (Available in Premium licenses):

Key Type Description
color string
  • accent1
  • accent2
  • accent3
  • accent4
  • accent5
  • accent6
  • dk1
  • dk2
  • folHlink
  • hlink
  • lt1
  • lt2
Exceptions

Position not valid.

Code samples

Example #1

The resulting PPTX looks like:

Example #2

The resulting PPTX looks like:

Release notes
  • phppptx 4.5:
    • theme, transparency option.
    • rotation uses 60.000ths of a degree.
  • phppptx 4.0:
    • extra check to avoid duplicated shape internal ids.
    • name option moved to the position array option.
  • phppptx 1.0:
    • new method.