Documentation

RichText extends AbstractShape
in package
implements ComparableInterface

\PhpOffice\PhpPresentation\Shape\RichText.

Table of Contents

Interfaces

ComparableInterface
PhpOffice\PhpPresentation\ComparableInterface.

Constants

AUTOFIT_DEFAULT  = 'spAutoFit'
Autofit
AUTOFIT_NOAUTOFIT  = 'noAutofit'
AUTOFIT_NORMAL  = 'normAutofit'
AUTOFIT_SHAPE  = 'spAutoFit'
OVERFLOW_CLIP  = 'clip'
Overflow
OVERFLOW_OVERFLOW  = 'overflow'
VALIGN_CENTER  = 1
Vertical alignment center
VALIGN_NOTCENTER  = 0
WRAP_NONE  = 'none'
Wrapping
WRAP_SQUARE  = 'square'

Properties

$container  : null|ShapeContainerInterface
Container.
$height  : int
Height.
$hyperlink  : null|Hyperlink
$name  : string
Name.
$offsetX  : int
Offset X.
$offsetY  : int
Offset Y.
$placeholder  : null|Placeholder
$rotation  : int
Rotation.
$shadow  : null|Shadow
Shadow.
$width  : int
Width.
$activeParagraph  : int
Active paragraph.
$autoFit  : string
Autofit.
$autoShrinkHorizontal  : null|bool
Horizontal Auto Shrink.
$autoShrinkVertical  : null|bool
Vertical Auto Shrink.
$border  : Border
Border.
$bottomInset  : float
Bottom inset (in pixels).
$columns  : int
Number of columns (1 - 16).
$columnSpacing  : int
The spacing between columns.
$fill  : null|Fill
$fontScale  : null|float
The percentage of the original font size to which the text is scaled.
$hashIndex  : int
Hash index.
$horizontalOverflow  : string
Horizontal overflow.
$leftInset  : float
Left inset (in pixels).
$lnSpcReduction  : null|float
The percentage of the reduction of the line spacing.
$richTextParagraphs  : array<string|int, Paragraph>
Rich text paragraphs.
$rightInset  : float
Right inset (in pixels).
$topInset  : float
Top inset (in pixels).
$upright  : bool
Text upright?
$vertical  : bool
Vertical text?
$verticalAlignCenter  : int
Define vertical text center position into shape (center,not center).
$verticalOverflow  : string
Vertical overflow.
$wrap  : string
Text wrapping.

Methods

__clone()  : mixed
Magic Method : clone.
__construct()  : mixed
Create a new \PhpOffice\PhpPresentation\Shape\RichText instance.
__toString()  : string
Convert to string.
addText()  : self
Add text.
createBreak()  : BreakElement
Create break.
createParagraph()  : Paragraph
Create paragraph.
createText()  : TextElement
Create text (can not be formatted !).
createTextRun()  : Run
Create text run (can be formatted).
getActiveParagraph()  : Paragraph
getActiveParagraphIndex()  : int
Get active paragraph index.
getAutoFit()  : string
Get autofit.
getBorder()  : Border
getColumns()  : int
Get columns.
getColumnSpacing()  : int
Get spacing between columns.
getContainer()  : ShapeContainerInterface|null
Get Container, Slide or Group.
getFill()  : Fill|null
getFontScale()  : float|null
Get pourcentage of fontScale.
getHashCode()  : string
Get hash code.
getHashIndex()  : null|int
Get hash index.
getHeight()  : int
Get Height.
getHorizontalOverflow()  : string
Get horizontal overflow.
getHyperlink()  : Hyperlink
Get Hyperlink.
getInsetBottom()  : float
Get bottom inset.
getInsetLeft()  : float
Get left inset.
getInsetRight()  : float
Get right inset.
getInsetTop()  : float
Get top inset.
getLineSpaceReduction()  : float|null
Get pourcentage of the line space reduction.
getName()  : string
Get Name.
getOffsetX()  : int
Get OffsetX.
getOffsetY()  : int
Get OffsetY.
getParagraph()  : Paragraph
Get paragraph.
getParagraphs()  : array<string|int, Paragraph>
getPlaceholder()  : Placeholder|null
getPlainText()  : string
Get plain text.
getRotation()  : int
Get Rotation.
getShadow()  : Shadow|null
getVerticalAlignCenter()  : int
Get the vertical alignment center.
getVerticalOverflow()  : string
Get vertical overflow.
getWidth()  : int
Get Width.
getWrap()  : string
Get text wrapping.
hasAutoShrinkHorizontal()  : bool|null
hasAutoShrinkVertical()  : bool|null
Set vertical auto shrink.
hasHyperlink()  : bool
Has Hyperlink?
isPlaceholder()  : bool
isUpright()  : bool
Get upright.
isVertical()  : bool
Get vertical.
setActiveParagraph()  : Paragraph
Set active paragraph.
setAutoFit()  : self
Set autofit.
setAutoShrinkHorizontal()  : self
setAutoShrinkVertical()  : self
Set vertical auto shrink.
setColumns()  : self
Set columns.
setColumnSpacing()  : self
Set spacing between columns.
setContainer()  : $this
Set Container, Slide or Group.
setFill()  : self
setHashIndex()  : $this
Set hash index.
setHeight()  : $this
Set Height.
setHorizontalOverflow()  : self
Set horizontal overflow.
setHyperlink()  : self
Set Hyperlink.
setInsetBottom()  : self
Set bottom inset.
setInsetLeft()  : self
Set left inset.
setInsetRight()  : self
Set left inset.
setInsetTop()  : self
Set top inset.
setName()  : static
Set Name.
setOffsetX()  : $this
Set OffsetX.
setOffsetY()  : $this
Set OffsetY.
setParagraphs()  : self
Set paragraphs.
setPlaceHolder()  : self
setRotation()  : $this
Set Rotation.
setShadow()  : $this
setUpright()  : self
Set vertical.
setVertical()  : self
Set vertical.
setVerticalAlignCenter()  : self
Define the vertical alignment if centered or not.
setVerticalOverflow()  : self
Set vertical overflow.
setWidth()  : $this
Set Width.
setWidthAndHeight()  : self
Set width and height with proportional resize.
setWrap()  : self
Set text wrapping.

Constants

AUTOFIT_DEFAULT

Autofit

public mixed AUTOFIT_DEFAULT = 'spAutoFit'

AUTOFIT_NOAUTOFIT

public mixed AUTOFIT_NOAUTOFIT = 'noAutofit'

AUTOFIT_NORMAL

public mixed AUTOFIT_NORMAL = 'normAutofit'

AUTOFIT_SHAPE

public mixed AUTOFIT_SHAPE = 'spAutoFit'

OVERFLOW_CLIP

Overflow

public mixed OVERFLOW_CLIP = 'clip'

OVERFLOW_OVERFLOW

public mixed OVERFLOW_OVERFLOW = 'overflow'

VALIGN_CENTER

Vertical alignment center

public mixed VALIGN_CENTER = 1

VALIGN_NOTCENTER

public mixed VALIGN_NOTCENTER = 0

WRAP_NONE

Wrapping

public mixed WRAP_NONE = 'none'

WRAP_SQUARE

public mixed WRAP_SQUARE = 'square'

Properties

$activeParagraph

Active paragraph.

private int $activeParagraph = 0

$autoFit

Autofit.

private string $autoFit = self::AUTOFIT_DEFAULT

$autoShrinkHorizontal

Horizontal Auto Shrink.

private null|bool $autoShrinkHorizontal

$autoShrinkVertical

Vertical Auto Shrink.

private null|bool $autoShrinkVertical

$bottomInset

Bottom inset (in pixels).

private float $bottomInset = 4.8

$columns

Number of columns (1 - 16).

private int $columns = 1

$columnSpacing

The spacing between columns.

private int $columnSpacing = 0

$fontScale

The percentage of the original font size to which the text is scaled.

private null|float $fontScale

$horizontalOverflow

Horizontal overflow.

private string $horizontalOverflow = self::OVERFLOW_OVERFLOW

$leftInset

Left inset (in pixels).

private float $leftInset = 9.6

$lnSpcReduction

The percentage of the reduction of the line spacing.

private null|float $lnSpcReduction

$richTextParagraphs

Rich text paragraphs.

private array<string|int, Paragraph> $richTextParagraphs = []

$rightInset

Right inset (in pixels).

private float $rightInset = 9.6

$topInset

Top inset (in pixels).

private float $topInset = 4.8

$upright

Text upright?

private bool $upright = false

$vertical

Vertical text?

private bool $vertical = false

$verticalAlignCenter

Define vertical text center position into shape (center,not center).

private int $verticalAlignCenter = self::VALIGN_NOTCENTER

$verticalOverflow

Vertical overflow.

private string $verticalOverflow = self::OVERFLOW_OVERFLOW

$wrap

Text wrapping.

private string $wrap = self::WRAP_SQUARE

Methods

__clone()

Magic Method : clone.

public __clone() : mixed

__construct()

Create a new \PhpOffice\PhpPresentation\Shape\RichText instance.

public __construct() : mixed

__toString()

Convert to string.

public __toString() : string
Return values
string

createText()

Create text (can not be formatted !).

public createText([string $pText = '' ]) : TextElement
Parameters
$pText : string = ''

Text

Return values
TextElement

createTextRun()

Create text run (can be formatted).

public createTextRun([string $pText = '' ]) : Run
Parameters
$pText : string = ''

Text

Return values
Run

getActiveParagraphIndex()

Get active paragraph index.

public getActiveParagraphIndex() : int
Return values
int

getAutoFit()

Get autofit.

public getAutoFit() : string
Return values
string

getColumns()

Get columns.

public getColumns() : int
Return values
int

getColumnSpacing()

Get spacing between columns.

public getColumnSpacing() : int
Return values
int

getFontScale()

Get pourcentage of fontScale.

public getFontScale() : float|null
Return values
float|null

getHashCode()

Get hash code.

public getHashCode() : string
Return values
string

Hash code

getHashIndex()

Get hash index.

public getHashIndex() : null|int

Note that this index may vary during script execution! Only reliable moment is while doing a write of a workbook and when changes are not allowed.

Return values
null|int

Hash index

getHeight()

Get Height.

public getHeight() : int
Return values
int

getHorizontalOverflow()

Get horizontal overflow.

public getHorizontalOverflow() : string
Return values
string

getInsetBottom()

Get bottom inset.

public getInsetBottom() : float
Return values
float

getInsetLeft()

Get left inset.

public getInsetLeft() : float
Return values
float

getInsetRight()

Get right inset.

public getInsetRight() : float
Return values
float

getInsetTop()

Get top inset.

public getInsetTop() : float
Return values
float

getLineSpaceReduction()

Get pourcentage of the line space reduction.

public getLineSpaceReduction() : float|null
Return values
float|null

getName()

Get Name.

public getName() : string
Return values
string

getOffsetX()

Get OffsetX.

public getOffsetX() : int
Return values
int

getOffsetY()

Get OffsetY.

public getOffsetY() : int
Return values
int

getParagraph()

Get paragraph.

public getParagraph([int $index = 0 ]) : Paragraph
Parameters
$index : int = 0
Return values
Paragraph

getPlainText()

Get plain text.

public getPlainText() : string
Return values
string

getRotation()

Get Rotation.

public getRotation() : int
Return values
int

getVerticalAlignCenter()

Get the vertical alignment center.

public getVerticalAlignCenter() : int
Return values
int

getVerticalOverflow()

Get vertical overflow.

public getVerticalOverflow() : string
Return values
string

getWidth()

Get Width.

public getWidth() : int
Return values
int

getWrap()

Get text wrapping.

public getWrap() : string
Return values
string

hasAutoShrinkHorizontal()

public hasAutoShrinkHorizontal() : bool|null
Return values
bool|null

hasAutoShrinkVertical()

Set vertical auto shrink.

public hasAutoShrinkVertical() : bool|null
Return values
bool|null

Has Hyperlink?

public hasHyperlink() : bool
Return values
bool

isPlaceholder()

public isPlaceholder() : bool
Return values
bool

isUpright()

Get upright.

public isUpright() : bool
Return values
bool

isVertical()

Get vertical.

public isVertical() : bool
Return values
bool

setActiveParagraph()

Set active paragraph.

public setActiveParagraph([int $index = 0 ]) : Paragraph
Parameters
$index : int = 0
Return values
Paragraph

setAutoFit()

Set autofit.

public setAutoFit([string $value = self::AUTOFIT_DEFAULT ][, float|null $fontScale = null ][, float|null $lnSpcReduction = null ]) : self
Parameters
$value : string = self::AUTOFIT_DEFAULT
$fontScale : float|null = null
$lnSpcReduction : float|null = null
Return values
self

setAutoShrinkHorizontal()

public setAutoShrinkHorizontal([bool|null $value = null ]) : self
Parameters
$value : bool|null = null
Return values
self

setAutoShrinkVertical()

Set vertical auto shrink.

public setAutoShrinkVertical([bool|null $value = null ]) : self
Parameters
$value : bool|null = null
Return values
self

setColumns()

Set columns.

public setColumns([int $value = 1 ]) : self
Parameters
$value : int = 1
Return values
self

setColumnSpacing()

Set spacing between columns.

public setColumnSpacing([int $value = 0 ]) : self
Parameters
$value : int = 0
Return values
self

setContainer()

Set Container, Slide or Group.

public setContainer([ShapeContainerInterface|null $pValue = null ][, bool $pOverrideOld = false ]) : $this
Parameters
$pValue : ShapeContainerInterface|null = null
$pOverrideOld : bool = false

If a Slide has already been assigned, overwrite it and remove image from old Slide?

Return values
$this

setFill()

public setFill([Fill|null $pValue = null ]) : self
Parameters
$pValue : Fill|null = null
Return values
self

setHashIndex()

Set hash index.

public setHashIndex(int $value) : $this

Note that this index may vary during script execution! Only reliable moment is while doing a write of a workbook and when changes are not allowed.

Parameters
$value : int

Hash index

Return values
$this

setHeight()

Set Height.

public setHeight([int $pValue = 0 ]) : $this
Parameters
$pValue : int = 0
Return values
$this

setHorizontalOverflow()

Set horizontal overflow.

public setHorizontalOverflow([string $value = self::OVERFLOW_OVERFLOW ]) : self
Parameters
$value : string = self::OVERFLOW_OVERFLOW
Return values
self

Set Hyperlink.

public setHyperlink([Hyperlink|null $pHyperlink = null ]) : self
Parameters
$pHyperlink : Hyperlink|null = null
Return values
self

setInsetBottom()

Set bottom inset.

public setInsetBottom([float $value = 4.8 ]) : self
Parameters
$value : float = 4.8
Return values
self

setInsetLeft()

Set left inset.

public setInsetLeft([float $value = 9.6 ]) : self
Parameters
$value : float = 9.6
Return values
self

setInsetRight()

Set left inset.

public setInsetRight([float $value = 9.6 ]) : self
Parameters
$value : float = 9.6
Return values
self

setInsetTop()

Set top inset.

public setInsetTop([float $value = 4.8 ]) : self
Parameters
$value : float = 4.8
Return values
self

setName()

Set Name.

public setName([string $pValue = '' ]) : static
Parameters
$pValue : string = ''
Return values
static

setOffsetX()

Set OffsetX.

public setOffsetX([int $pValue = 0 ]) : $this
Parameters
$pValue : int = 0
Return values
$this

setOffsetY()

Set OffsetY.

public setOffsetY([int $pValue = 0 ]) : $this
Parameters
$pValue : int = 0
Return values
$this

setParagraphs()

Set paragraphs.

public setParagraphs([array<string|int, Paragraph$paragraphs = [] ]) : self
Parameters
$paragraphs : array<string|int, Paragraph> = []

Array of paragraphs

Return values
self

setRotation()

Set Rotation.

public setRotation([int $pValue = 0 ]) : $this
Parameters
$pValue : int = 0
Return values
$this

setShadow()

public setShadow([Shadow|null $pValue = null ]) : $this
Parameters
$pValue : Shadow|null = null
Return values
$this

setUpright()

Set vertical.

public setUpright([bool $value = false ]) : self
Parameters
$value : bool = false
Return values
self

setVertical()

Set vertical.

public setVertical([bool $value = false ]) : self
Parameters
$value : bool = false
Return values
self

setVerticalAlignCenter()

Define the vertical alignment if centered or not.

public setVerticalAlignCenter(int $value) : self
Parameters
$value : int

1=center 0=not

Tags
see

self::VALIGN_CENTER, self::VALIGN_NOTCENTER

Return values
self

setVerticalOverflow()

Set vertical overflow.

public setVerticalOverflow([string $value = self::OVERFLOW_OVERFLOW ]) : self
Parameters
$value : string = self::OVERFLOW_OVERFLOW
Return values
self

setWidth()

Set Width.

public setWidth([int $pValue = 0 ]) : $this
Parameters
$pValue : int = 0
Return values
$this

setWidthAndHeight()

Set width and height with proportional resize.

public setWidthAndHeight([int $width = 0 ][, int $height = 0 ]) : self
Parameters
$width : int = 0
$height : int = 0
Return values
self

setWrap()

Set text wrapping.

public setWrap([string $value = self::WRAP_SQUARE ]) : self
Parameters
$value : string = self::WRAP_SQUARE
Return values
self

        
On this page

Search results