Word2007
extends AbstractWriter
in package
implements
WriterInterface
Word2007 writer.
Table of Contents
Interfaces
- WriterInterface
- Writer interface.
Properties
- $mediaPaths : array<string|int, mixed>
- Paths to store media files.
- $parts : array<string|int, mixed>
- Part name and file name pairs.
- $phpWord : PhpWord
- PHPWord object.
- $writerParts : array<string|int, mixed>
- Individual writers.
- $contentTypes : array<string|int, mixed>
- Content types values.
- $diskCachingDirectory : string
- Disk caching directory.
- $originalFilename : string
- Original file name.
- $relationships : array<string|int, mixed>
- Document relationship.
- $tempDir : string
- Temporary directory.
- $tempFilename : string
- Temporary file name.
- $useDiskCaching : bool
- Use disk caching.
Methods
- __construct() : mixed
- Create new Word2007 writer.
- getContentTypes() : array<string|int, mixed>
- Get content types.
- getDiskCachingDirectory() : string
- Get disk caching directory.
- getPhpWord() : PhpWord
- Get PhpWord object.
- getRelationships() : array<string|int, mixed>
- Get content types.
- getTempDir() : string
- Get temporary directory.
- getWriterPart() : mixed
- Get writer part.
- isUseDiskCaching() : bool
- Get use disk caching status.
- save() : void
- Save document by name.
- setPhpWord() : self
- Set PhpWord object.
- setTempDir() : self
- Set temporary directory.
- setUseDiskCaching() : self
- Set use disk caching status.
- addFilesToPackage() : void
- Add files to package.
- addFileToPackage() : void
- Add file to package.
- cleanupTempFile() : void
- Cleanup temporary file.
- clearTempDir() : void
- Clear temporary directory.
- getTempFile() : string
- Get temporary file name.
- getZipArchive() : ZipArchive
- Get ZipArchive object.
- openFile() : resource
- Open file for writing.
- writeFile() : void
- Write content to file.
- addChart() : void
- Add chart.
- addComments() : void
- Add comments.
- addHeaderFooterContent() : void
- Add header/footer content.
- addHeaderFooterMedia() : void
- Add header/footer media files, e.g. footer1.xml.rels.
- addNotes() : void
- Add footnotes/endnotes.
- deleteDir() : void
- Delete directory.
- registerContentTypes() : void
- Register content types for each media.
Properties
$mediaPaths
Paths to store media files.
protected
array<string|int, mixed>
$mediaPaths
= ['image' => '', 'object' => '']
$parts
Part name and file name pairs.
protected
array<string|int, mixed>
$parts
= []
$phpWord
PHPWord object.
protected
PhpWord
$phpWord
$writerParts
Individual writers.
protected
array<string|int, mixed>
$writerParts
= []
$contentTypes
Content types values.
private
array<string|int, mixed>
$contentTypes
= ['default' => [], 'override' => []]
$diskCachingDirectory
Disk caching directory.
private
string
$diskCachingDirectory
= './'
$originalFilename
Original file name.
private
string
$originalFilename
$relationships
Document relationship.
private
array<string|int, mixed>
$relationships
= []
$tempDir
Temporary directory.
private
string
$tempDir
= ''
$tempFilename
Temporary file name.
private
string
$tempFilename
$useDiskCaching
Use disk caching.
private
bool
$useDiskCaching
= false
Methods
__construct()
Create new Word2007 writer.
public
__construct([PhpWord|null $phpWord = null ]) : mixed
Parameters
- $phpWord : PhpWord|null = null
getContentTypes()
Get content types.
public
getContentTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getDiskCachingDirectory()
Get disk caching directory.
public
getDiskCachingDirectory() : string
Return values
stringgetPhpWord()
Get PhpWord object.
public
getPhpWord() : PhpWord
Return values
PhpWordgetRelationships()
Get content types.
public
getRelationships() : array<string|int, mixed>
Return values
array<string|int, mixed>getTempDir()
Get temporary directory.
public
getTempDir() : string
Return values
stringgetWriterPart()
Get writer part.
public
getWriterPart([string $partName = '' ]) : mixed
Parameters
- $partName : string = ''
-
Writer part name
isUseDiskCaching()
Get use disk caching status.
public
isUseDiskCaching() : bool
Return values
boolsave()
Save document by name.
public
save(string $filename) : void
Parameters
- $filename : string
setPhpWord()
Set PhpWord object.
public
setPhpWord([PhpWord|null $phpWord = null ]) : self
Parameters
- $phpWord : PhpWord|null = null
Return values
selfsetTempDir()
Set temporary directory.
public
setTempDir(string $value) : self
Parameters
- $value : string
Return values
selfsetUseDiskCaching()
Set use disk caching status.
public
setUseDiskCaching([bool $value = false ][, string $directory = null ]) : self
Parameters
- $value : bool = false
- $directory : string = null
Return values
selfaddFilesToPackage()
Add files to package.
protected
addFilesToPackage(ZipArchive $zip, mixed $elements) : void
Parameters
- $zip : ZipArchive
- $elements : mixed
addFileToPackage()
Add file to package.
protected
addFileToPackage(ZipArchive $zipPackage, string $source, string $target) : void
Get the actual source from an archive image.
Parameters
- $zipPackage : ZipArchive
- $source : string
- $target : string
cleanupTempFile()
Cleanup temporary file.
protected
cleanupTempFile() : void
clearTempDir()
Clear temporary directory.
protected
clearTempDir() : void
getTempFile()
Get temporary file name.
protected
getTempFile(string $filename) : string
If $filename is php://output or php://stdout, make it a temporary file
Parameters
- $filename : string
Return values
stringgetZipArchive()
Get ZipArchive object.
protected
getZipArchive(string $filename) : ZipArchive
Parameters
- $filename : string
Return values
ZipArchiveopenFile()
Open file for writing.
protected
openFile(string $filename) : resource
Parameters
- $filename : string
Tags
Return values
resourcewriteFile()
Write content to file.
protected
writeFile(resource $fileHandle, string $content) : void
Parameters
- $fileHandle : resource
- $content : string
Tags
addChart()
Add chart.
private
addChart(ZipArchive $zip, int &$rId) : void
Parameters
- $zip : ZipArchive
- $rId : int
addComments()
Add comments.
private
addComments(ZipArchive $zip, int &$rId) : void
Parameters
- $zip : ZipArchive
- $rId : int
addHeaderFooterContent()
Add header/footer content.
private
addHeaderFooterContent(Section &$section, ZipArchive $zip, string $elmType, int &$rId) : void
Parameters
- $section : Section
- $zip : ZipArchive
- $elmType : string
-
header|footer
- $rId : int
addHeaderFooterMedia()
Add header/footer media files, e.g. footer1.xml.rels.
private
addHeaderFooterMedia(ZipArchive $zip, string $docPart) : void
Parameters
- $zip : ZipArchive
- $docPart : string
addNotes()
Add footnotes/endnotes.
private
addNotes(ZipArchive $zip, int &$rId[, string $noteType = 'footnote' ]) : void
Parameters
- $zip : ZipArchive
- $rId : int
- $noteType : string = 'footnote'
deleteDir()
Delete directory.
private
deleteDir(string $dir) : void
Parameters
- $dir : string
registerContentTypes()
Register content types for each media.
private
registerContentTypes(array<string|int, mixed> $media) : void
Parameters
- $media : array<string|int, mixed>