addTextBox
addTextBox
BASIC / ADVANCED / PREMIUM
Inserts a text box into the Excel spreadsheet.
Description
public addTextBox($contents, $position, $textBoxStyles = array(), $options = array())
This method inserts text boxes into the Excel spreadsheet.
Parameters
contents
This could be:
- a string
- an array with the following keys and values:
Key | Type | Description |
---|---|---|
text | string | The content to be inserted. |
bold | bool | If true the content will be shown in bold characters. |
color | string | Hexadecimal color value: 'FF0000', '000000'... |
font | string | Font family: 'Arial', 'Calibri'... |
fontSize | int | Font size in points. |
highlight | string | Hexadecimal color value: 'FF0000', '000000'... |
italic | bool | If true displays the content in italics. |
strikethrough | bool | If true displays text in strikethrough. |
subscript | bool | If true displays text in subscript. |
superscript | bool | If true displays text in superscript. |
underline | string | Underlines text: single, double. |
- a multidimensional array to add rich text contents
position
Cell position in the active sheet: A1, C3, AB7...
textBoxStyles
Key | Type | Description |
---|---|---|
align | string | left, center, right. |
backgroundColor | string | Hexadecimal color value: 'FF0000', '000000'... |
verticalAlign | string | top, middle, bottom. |
options
Key | Type | Description |
---|---|---|
colOffset | array |
|
colSize | int | Number of columns used by the text box. |
editAs | string | Possible values are:
|
name | string | Sets a name value. |
rowOffset | array |
|
rowSize | int | Number of rows used by the text box. |
Release notes
- phpxlsx 3.0:
- new method.