addText
- getTemplateVariables
- getTemplateVariablesType
- processTemplate
- removeVariableAudio
- removeVariableImage
- removeVariableText
- removeVariableVideo
- replaceVariableAudio
- replaceVariableHtml
- replaceVariableImage
- replaceVariableList
- replaceVariablePptxFragment
- replaceVariableTable
- replaceVariableText
- replaceVariableVideo
- setTemplateSymbol
addText
BASIC / ADVANCED / PREMIUM
Inserts a text into the PowerPoint presentation.
Description
public addText($contents, $position, $paragraphStyles = array(), $options = array())
This method inserts texts into the PowerPoint presentation.
Parameters
contents
Array of text contents and styles.
| Key | Type | Description |
|---|---|---|
| text | string | Text content. |
| bold | bool | |
| characterSpacing | int | |
| color | string | HEX color. |
| font | string | Font family. |
| fontSize | int | 8, 9, 10, 11... |
| highlight | string | HEX color. |
| hyperlink | string | Hyperlink. External, bookmark (#firstslide, #lastslide, #nextslide, #previousslide) or slide (#slide with position). |
| italic | bool | |
| lang | string | Language. |
| strikethrough | bool | |
| underline | string | Underline: single. |
position
| Key | Type | Description |
|---|---|---|
| placeholder | array |
The content is added in a placeholder of the layout. One of the following options can be used to get the text box.
|
| new | array |
A new position is generated.
|
paragraphStyles
| Key | Type | Description |
|---|---|---|
| align | string | left, center, right, justify, distributed. |
| indentation | int | EMUs (English Metric Unit) |
| lineSpacing | int|float | 1, 1.5, 2... |
| listLevel | int | 0, 1, 2... |
| listStyles | array | view addList |
| marginLeft | int | EMUs (English Metric Unit) (0 >= and <= 51206400) |
| marginRight | int | EMUs (English Metric Unit) (0 >= and <= 51206400) |
| noBullet | bool | No bullet added. Default as true |
| parseLineBreaks | bool | If true parses the line breaks. Default as false |
| spacingAfter | int | points (0 >= and <= 158400) |
| spacingBefore | int | points (0 >= and <= 158400) |
options
| Key | Type | Description |
|---|---|---|
| insertMode | string |
Insert mode if the position contains an existing content:
Default as append. |
Exceptions
Position not valid.
Hyperlink slide position not valid.
Code samples
Release notes
- phppptx 4.0:
- marginRight option.
- phppptx 3.5:
- distributed align.
- indentation, marginLeft, spacingAfter, spacingBefore, listLevel, listStyles options.
- phppptx 2.0:
- parseLineBreaks option.
- phppptx 1.0:
- new method.