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
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
$fileHandle
File pointer.
protected
bool|resource
$fileHandle
$imageLoading
Load images.
protected
bool
$imageLoading
= true
$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
boolhasImageLoading()
public
hasImageLoading() : bool
Return values
boolisReadDataOnly()
Read data only?
public
isReadDataOnly() : bool
Return values
boolload()
Loads PhpWord from file.
public
load(string $docFile) : PhpWord
Parameters
- $docFile : string
Return values
PhpWordsetImageLoading()
public
setImageLoading(bool $value) : self
Parameters
- $value : bool
Return values
selfsetReadDataOnly()
Set read data only.
public
setReadDataOnly([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfextractText()
Extract the UTF-16LE text from the CONTENTS stream of a WPS document.
protected
extractText(string $filename) : string
Parameters
- $filename : string
Return values
stringgetULong()
Read a 32-bit unsigned integer (little endian).
protected
getULong(string $data, int $offset) : int
Parameters
- $data : string
- $offset : int
Return values
intgetUShort()
Read a 16-bit unsigned integer (little endian).
protected
getUShort(string $data, int $offset) : int
Parameters
- $data : string
- $offset : int
Return values
intopenFile()
Open file for reading.
protected
openFile(string $filename) : resource
Parameters
- $filename : string
Return values
resourcereadContentsStream()
Read the OLE "CONTENTS" stream of a WPS document.
protected
readContentsStream(string $filename) : string
Parameters
- $filename : string