Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
setPhpWord($phpWord);
// Create parts
$this->parts = [
'Mimetype' => 'mimetype',
'Content' => 'content.xml',
'Meta' => 'meta.xml',
'Styles' => 'styles.xml',
'Manifest' => 'META-INF/manifest.xml',
];
foreach (array_keys($this->parts) as $partName) {
$partClass = static::class . '\\Part\\' . $partName;
if (class_exists($partClass)) {
/** @var \PhpOffice\PhpWord\Writer\ODText\Part\AbstractPart $partObject Type hint */
$partObject = new $partClass();
$partObject->setParentWriter($this);
$this->writerParts[strtolower($partName)] = $partObject;
}
}
// Set package paths
$this->mediaPaths = ['image' => 'Pictures/'];
}
/**
* Save PhpWord to file.
*
* @param string $filename
*/
public function save($filename = null): void
{
$filename = $this->getTempFile($filename);
$zip = $this->getZipArchive($filename);
// Add section media files
$sectionMedia = Media::getElements('section');
if (!empty($sectionMedia)) {
$this->addFilesToPackage($zip, $sectionMedia);
}
// Write parts
foreach ($this->parts as $partName => $fileName) {
if ($fileName != '') {
$zip->addFromString($fileName, $this->getWriterPart($partName)->write());
}
}
// Close zip archive and cleanup temp file
$zip->close();
$this->cleanupTempFile();
}
}