Sample 10 EastAsianFontStyle

01:29:41 Create new PhpWord object
01:29:41 Write to Word2007 format
01:29:41 Write to ODText format
01:29:41 Write to RTF format
01:29:41 Write to HTML format
01:29:41 Write to PDF format
01:29:41 Done writing file(s)
01:29:41 Peak memory usage: 2 MB

 

Results: docx odt rtf html pdf


<?php

include_once 'Sample_Header.php';

// New Word Document
echo date('H:i:s'), ' Create new PhpWord object'EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section $phpWord->addSection();
$header = array('size' => 16'bold' => true);
//1.Use EastAisa FontStyle
$section->addText('中文楷体样式测试', array('name' => '楷体''size' => 16'color' => '1B2232''lang' => array('latin' => 'en-US''eastAsia' => 'zh-CN')));

// Save file
echo write($phpWordbasename(__FILE__'.php'), $writers);
if (!
CLI) {
    include_once 
'Sample_Footer.php';
}