Constants

PARA

PARA = 'readParagraph'

STYL

STYL = 'readStyle'

SKIP

SKIP = 'readSkip'

Properties

$rtf

$rtf : string

RTF content

Type

string

$length

$length : integer

Content length

Type

integer

$offset

$offset : integer

Character index

Type

integer

$control

$control : string

Current control word

Type

string

$text

$text : string

Text content

Type

string

$isControl

$isControl : boolean

Parsing a control word flag

Type

boolean

$isFirst

$isFirst : boolean

First character flag: watch out for control symbols

Type

boolean

$groups

$groups : array

Group groups

Type

array

$flags

$flags : array

Parser flags; not used

Type

array

Methods

read()

read(\PhpOffice\PhpWord\PhpWord  $phpWord) 

Parse RTF content

  • Marks controlling characters {, }, and \
  • Removes line endings
  • Builds control words and control symbols
  • Pushes every other character into the text queue

Parameters

\PhpOffice\PhpWord\PhpWord $phpWord

markOpening()

markOpening() 

Mark opening braket `{` character.

markClosing()

markClosing() 

Mark closing braket `}` character.

markBackslash()

markBackslash() 

Mark backslash `\` character.

markNewline()

markNewline() 

Mark newline character: Flush control word because it's not possible to span multiline.

flush()

flush(boolean  $isControl = false) 

Flush control word or text.

Parameters

boolean $isControl

flushControl()

flushControl(boolean  $isControl = false) 

Flush control word.

Parameters

boolean $isControl

flushText()

flushText() 

Flush text in queue.

setControl()

setControl(boolean  $value) 

Reset control word and first char state.

Parameters

boolean $value

pushText()

pushText(string  $char) 

Push text into queue.

Parameters

string $char

parseControl()

parseControl(string  $control, string  $parameter) 

Parse control.

Parameters

string $control
string $parameter

readParagraph()

readParagraph(array  $directives) 

Read paragraph.

Parameters

array $directives

readStyle()

readStyle(array  $directives) 

Read style.

Parameters

array $directives

readSkip()

readSkip(array  $directives) 

Read skip.

Parameters

array $directives

readText()

readText() 

Read text.