// 打开word 编辑
$file = 'C:/Users/Administrator/Desktop/11.doc';
$word = new \com("word.application",null,CP_UTF8) or die("Unable to instantiate Word");
$word->Visible = 0;
$word->Documents->Open($file,true,false);
$Paragraphs = $word->ActiveDocument->Paragraphs;
for ($i = 1; $i <= $Paragraphs->Count; $i++) {
$font = $Paragraphs->Item($i)->Range->Font;
$font->Name='仿宋_GB2312';
$font->Size=16;
}
$word->ActiveDocument->Save();
$word->Quit();
$word = null;
有的文档的字号可能是三号,小二等汉字形式,那么用此方法打印一下$font->Size
即可换算成数字。