getParentWriter()->getPhpWord()->getDocInfo(); $propertiesMapping = [ 'creator' => 'author', 'title' => '', 'description' => '', 'subject' => '', 'keywords' => '', 'category' => '', 'company' => '', 'manager' => '', ]; $title = $docProps->getTitle(); $title = ($title != '') ? $title : 'PHPWord'; $content = ''; $content .= '' . PHP_EOL; $content .= '' . PHP_EOL; $content .= '' . $title . '' . PHP_EOL; foreach ($propertiesMapping as $key => $value) { $value = ($value == '') ? $key : $value; $method = 'get' . $key; if ($docProps->$method() != '') { $content .= '' . PHP_EOL; } } $content .= $this->writeStyles(); $content .= '' . PHP_EOL; return $content; } /** * Get styles. */ private function writeStyles(): string { $css = '' . PHP_EOL; return $css; } /** * Set font and alternates for css font-family. */ private function getFontFamily(string $font, string $genericFont): string { if (empty($font)) { return ''; } $fontfamily = "'" . htmlspecialchars($font, ENT_QUOTES, 'UTF-8') . "'"; if (!empty($genericFont)) { $fontfamily .= ", $genericFont"; } return $fontfamily; } }