addMathEquation

addMathEquation

BASIC / ADVANCED / PREMIUM

Adds math equations into the Excel spreadsheet.

Description
public addMathEquation($equation, $type, $position, $equationStyles = array(), $options = array())

This method allows adding math equations into the Excel spreadsheet.

Parameters

equation

OMML equation string or MathML.

type

Type of equation: omml, mathml.

position

Cell position in the active sheet: A1, C3, AB7...

equationStyles

Key Type Description
align string left, center, right.
color string Hexadecimal color value: 'FF0000', '000000'...
fontSize int 8, 9, 10...

options

Key Type Description
colOffset array
  • 'from' (int) column size offset from.
  • 'to' (int) column size offset to.
colSize int Number of columns used by the text box.
editAs string Possible values are:
  • 'oneCell' (default) : move but don't size with cells.
  • 'twoCell' : move and size with cells.
  • 'absolute' : don't move or size with cells.
name string Sets a name value.
rowOffset array
  • 'from' (int) row size offset from.
  • 'to' (int) row size offset to.
rowSize int Number of rows used by the text box.
Exceptions

Not valid type.

Code samples

Example #1

The resulting XLSX looks like:

Example #2

The resulting XLSX looks like:

Release notes
  • phpxlsx 3.0: new method.