Skip to content

Commit af1a591

Browse files
committed
support for eastAsia fontstyle
support for eastAsia fontstyle add sample 10
1 parent 3daaffa commit af1a591

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Classes/PHPWord/Writer/Word2007/Base.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ protected function _writeTextStyle(PHPWord_Shared_XMLWriter $objWriter = null, P
380380
$underline = $style->getUnderline();
381381
$superscript = $style->getSuperScript();
382382
$subscript = $style->getSubScript();
383+
$hint='';
383384

384385
$objWriter->startElement('w:rPr');
385386

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
error_reporting(E_ALL);
4+
5+
if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
6+
define('EOL', PHP_EOL);
7+
} else {
8+
define('EOL', '<br />');
9+
}
10+
11+
require_once '../Classes/PHPWord.php';
12+
13+
// New Word Document
14+
echo date('H:i:s') , ' Create new PHPWord object' , EOL;
15+
$PHPWord = new PHPWord();
16+
$section = $PHPWord->createSection();
17+
$header = array('size' => 16, 'bold' => true);
18+
//1.Use EastAisa FontStyle
19+
$section->addText('中文楷体样式测试',array('name' => '楷体', 'size' => 16, 'color' => '1B2232'));
20+
21+
// Save File
22+
echo date('H:i:s') , ' Write to Word2007 format' , EOL;
23+
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
24+
$objWriter->save(str_replace('.php', '.docx', __FILE__));
25+
26+
// Echo memory peak usage
27+
echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , ' MB' , EOL;
28+
29+
// Echo done
30+
echo date('H:i:s') , ' Done writing file' , EOL;

0 commit comments

Comments
 (0)