addHtml
addHtml
BASIC / ADVANCED / PREMIUM
Inserts HTML and CSS into the PowerPoint presentation.
Description
public addHtml($html, $position, $options = array())
This method allows the insertion of HTML into the PowerPoint presentation.
To embed accents and other non-ASCII characters such as á or ü, please check that the PHP Tidy extension and the PHP mbstring extension are installed and enabled.
Parameters
html
HTML and CSS content to be transformed.
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.
|
options
Key | Type | Description |
---|---|---|
disableWrapValue | bool | If true disable using a wrap value with Tidy to prevent extra blank spaces. Default as false. |
forceNotTidy | bool | False as default. If true, avoid using Tidy. Only recommended if Tidy can't be installed. |
insertMode | string |
Insert mode if the position contains an existing content:
Default as append. |
parseCSSVars | bool | If true parses CSS variables. |
Supported HTML contents and CSS styles
-
a tags
- see text element styles
-
br tags
-
p, h1, h2, h3, h4, h5, h6 tags
- background-color
- dir: ltr, rtl
- text-align: left, center, right
-
span, b, cite, em, i, s, strong, var tags
- see text element styles
-
text element styles
- background-color
- color
- font-family
- font-size
- font-style: italic, oblique
- font-weight: bold, bolder, 700, 800, 900
- letter-spacing
- text-decoration: line-through, underline
Exceptions
PHP Tidy is not enabled.
Position not valid.
Release notes
- phppptx 3.0:
- CSS variables.
- root and only-child selectors.
- improved CSS media query handling.
- CSS 8-digit HEX colors added as 6-digit HEX colors.
- phppptx 2.5:
- default HTML content when adding an empty content.
- phppptx 2.0:
- breaks.
- phppptx 1.0:
- new method.