support for eastAsia fontstyle

support for eastAsia fontstyle
add sample 10
This commit is contained in:
jhfangying 2014-03-13 08:48:18 +08:00
parent 3daaffa183
commit af1a591271
2 changed files with 31 additions and 0 deletions

View File

@ -380,6 +380,7 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart
$underline = $style->getUnderline(); $underline = $style->getUnderline();
$superscript = $style->getSuperScript(); $superscript = $style->getSuperScript();
$subscript = $style->getSubScript(); $subscript = $style->getSubScript();
$hint='';
$objWriter->startElement('w:rPr'); $objWriter->startElement('w:rPr');

View File

@ -0,0 +1,30 @@
<?php
error_reporting(E_ALL);
if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
define('EOL', PHP_EOL);
} else {
define('EOL', '<br />');
}
require_once '../Classes/PHPWord.php';
// New Word Document
echo date('H:i:s') , ' Create new PHPWord object' , EOL;
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$header = array('size' => 16, 'bold' => true);
//1.Use EastAisa FontStyle
$section->addText('中文楷体样式测试',array('name' => '楷体', 'size' => 16, 'color' => '1B2232'));
// Save File
echo date('H:i:s') , ' Write to Word2007 format' , EOL;
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save(str_replace('.php', '.docx', __FILE__));
// Echo memory peak usage
echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , ' MB' , EOL;
// Echo done
echo date('H:i:s') , ' Done writing file' , EOL;