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).
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)
  • 'imageTransparency' (int)
  • 'imageAsTexture' (bool) default as false
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 Rotation.
textDirection string horz, vert, vert270, wordArtVert, eaVert, mongolianVert, wordArtVertRtl.
verticalAlign string top, middle, bottom, topCentered, middleCentered, bottomCentered.
wrap string square, none.

options

Key Type Description
name string Text box internal name. If not set, a random name is generated.
Exceptions

Position not valid.

Code samples

Example #1

The resulting PPTX looks like:

Example #2

The resulting PPTX looks like:

Release notes
  • phppptx 1.0: new method.