Documentation

WPS extends AbstractReader
in package
implements ReaderInterface

Reader for Microsoft Works WPS documents (Works 8 and later).

Extracts the textual content stored in the OLE "CONTENTS" stream. The stream begins with the "CHNKWKS" magic and holds a linked list of chunk blocks; each block starts with an 0x01F8 tag followed by named entries, one of which ("TEXT") points at the UTF-16LE document text.

Tags
see
https://github.com/PHPOffice/PHPWord/issues/69
since
1.5.0

Table of Contents

Interfaces

ReaderInterface
Reader interface.

Constants

CHUNK_BLOCK_SIZE  : mixed = 0xe00
Chunk block size.
CHUNK_MAGIC  : mixed = 0x1f8
Chunk block tag.

Properties

$fileHandle  : bool|resource
File pointer.
$imageLoading  : bool
Load images.
$readDataOnly  : bool
Read data only?

Methods

__construct()  : mixed
canRead()  : bool
Can the current Reader read the file?
hasImageLoading()  : bool
isReadDataOnly()  : bool
Read data only?
load()  : PhpWord
Loads PhpWord from file.
setImageLoading()  : self
setReadDataOnly()  : self
Set read data only.
extractText()  : string
Extract the UTF-16LE text from the CONTENTS stream of a WPS document.
getULong()  : int
Read a 32-bit unsigned integer (little endian).
getUShort()  : int
Read a 16-bit unsigned integer (little endian).
openFile()  : resource
Open file for reading.
readContentsStream()  : string
Read the OLE "CONTENTS" stream of a WPS document.

Constants

CHUNK_BLOCK_SIZE

Chunk block size.

public mixed CHUNK_BLOCK_SIZE = 0xe00

CHUNK_MAGIC

Chunk block tag.

public mixed CHUNK_MAGIC = 0x1f8

Properties

$readDataOnly

Read data only?

protected bool $readDataOnly = true

Methods

__construct()

public __construct() : mixed

canRead()

Can the current Reader read the file?

public canRead(string $filename) : bool
Parameters
$filename : string
Return values
bool

hasImageLoading()

public hasImageLoading() : bool
Return values
bool

isReadDataOnly()

Read data only?

public isReadDataOnly() : bool
Return values
bool

load()

Loads PhpWord from file.

public load(string $docFile) : PhpWord
Parameters
$docFile : string
Return values
PhpWord

setImageLoading()

public setImageLoading(bool $value) : self
Parameters
$value : bool
Return values
self

setReadDataOnly()

Set read data only.

public setReadDataOnly([bool $value = true ]) : self
Parameters
$value : bool = true
Return values
self

extractText()

Extract the UTF-16LE text from the CONTENTS stream of a WPS document.

protected extractText(string $filename) : string
Parameters
$filename : string
Return values
string

getULong()

Read a 32-bit unsigned integer (little endian).

protected getULong(string $data, int $offset) : int
Parameters
$data : string
$offset : int
Return values
int

getUShort()

Read a 16-bit unsigned integer (little endian).

protected getUShort(string $data, int $offset) : int
Parameters
$data : string
$offset : int
Return values
int

openFile()

Open file for reading.

protected openFile(string $filename) : resource
Parameters
$filename : string
Return values
resource

readContentsStream()

Read the OLE "CONTENTS" stream of a WPS document.

protected readContentsStream(string $filename) : string
Parameters
$filename : string
Return values
string
On this page

Search results