Properties

$parts

$parts : array

Part name and file name pairs

Type

array

$writerParts

$writerParts : array

Individual writers

Type

array

$mediaPaths

$mediaPaths : array

Paths to store media files

Type

array

$isPdf

$isPdf : boolean

Is the current writer creating PDF?

Type

boolean

$notes

$notes : array

Footnotes and endnotes collection

Type

array

$useDiskCaching

$useDiskCaching : boolean

Use disk caching

Type

boolean

$diskCachingDirectory

$diskCachingDirectory : string

Disk caching directory

Type

string

$tempDir

$tempDir : string

Temporary directory

Type

string

$originalFilename

$originalFilename : string

Original file name

Type

string

$tempFilename

$tempFilename : string

Temporary file name

Type

string

Methods

getPhpWord()

getPhpWord() : \PhpOffice\PhpWord\PhpWord

Get PhpWord object

Throws

\PhpOffice\PhpWord\Exception\Exception

Returns

\PhpOffice\PhpWord\PhpWord

setPhpWord()

setPhpWord(\PhpOffice\PhpWord\PhpWord  $phpWord = null) : self

Set PhpWord object

Parameters

\PhpOffice\PhpWord\PhpWord $phpWord

Returns

self

getWriterPart()

getWriterPart(string  $partName = '') : mixed

Get writer part

Parameters

string $partName

Writer part name

Returns

mixed

isUseDiskCaching()

isUseDiskCaching() : boolean

Get use disk caching status

Returns

boolean

setUseDiskCaching()

setUseDiskCaching(boolean  $value = false, string  $directory = null) : self

Set use disk caching status

Parameters

boolean $value
string $directory

Throws

\PhpOffice\PhpWord\Exception\Exception

Returns

self

getDiskCachingDirectory()

getDiskCachingDirectory() : string

Get disk caching directory

Returns

string

getTempDir()

getTempDir() : string

Get temporary directory

Returns

string

setTempDir()

setTempDir(string  $value) : self

Set temporary directory

Parameters

string $value

Returns

self

getUseDiskCaching()

getUseDiskCaching() 

Get use disk caching status

__construct()

__construct(\PhpOffice\PhpWord\PhpWord  $phpWord = null) 

Create new instance

Parameters

\PhpOffice\PhpWord\PhpWord $phpWord

save()

save(string  $filename = null) 

Save PhpWord to file.

Parameters

string $filename

Throws

\PhpOffice\PhpWord\Exception\Exception

getContent()

getContent() : string

Get content

Returns

string

isPdf()

isPdf() : boolean

Get is PDF

Returns

boolean

getNotes()

getNotes() : array

Get notes

Returns

array

addNote()

addNote(integer  $noteId, string  $noteMark) 

Add note.

Parameters

integer $noteId
string $noteMark

writeDocument()

writeDocument() : string

Write document

Returns

string

getTempFile()

getTempFile(string  $filename) : string

Get temporary file name

If $filename is php://output or php://stdout, make it a temporary file

Parameters

string $filename

Returns

string

cleanupTempFile()

cleanupTempFile() 

Cleanup temporary file.

Throws

\PhpOffice\PhpWord\Exception\CopyFileException

clearTempDir()

clearTempDir() 

Clear temporary directory.

getZipArchive()

getZipArchive(string  $filename) : \PhpOffice\PhpWord\Shared\ZipArchive

Get ZipArchive object

Parameters

string $filename

Throws

\Exception

Returns

\PhpOffice\PhpWord\Shared\ZipArchive

openFile()

openFile(string  $filename) : resource

Open file for writing

Parameters

string $filename

Throws

\Exception

Returns

resource

writeFile()

writeFile(resource  $fileHandle, string  $content) 

Write content to file.

Parameters

resource $fileHandle
string $content

addFilesToPackage()

addFilesToPackage(\PhpOffice\PhpWord\Shared\ZipArchive  $zip, mixed  $elements) 

Add files to package.

Parameters

\PhpOffice\PhpWord\Shared\ZipArchive $zip
mixed $elements

addFileToPackage()

addFileToPackage(\PhpOffice\PhpWord\Shared\ZipArchive  $zipPackage, string  $source, string  $target) 

Add file to package.

Get the actual source from an archive image.

Parameters

\PhpOffice\PhpWord\Shared\ZipArchive $zipPackage
string $source
string $target

deleteDir()

deleteDir(string  $dir) 

Delete directory.

Parameters

string $dir