https://github.com/PHPOffice/PHPWordrequire_once'src/PhpWord/Autoloader.php';\PhpOffice\PhpWord\Autoloader::register();$phpWord=new\PhpOffice\PhpWord\PhpWord();//Everyelementyouwanttoappendtotheworddocumentisplacedinasection.//Tocreateabasicsection:$section=$phpWord->addSection();//Aftercreatingasection,youcanappendelements:$section->addText("hello&word");$objWriter=\PhpOffice\PhpWord\IOFactory::createWriter($phpWord,'Word2007');$objWriter->save('helloworld.doc');以上是生成文档的代码,因为是技术的文档所以必须要“&”这个符号。不知道什么原因加了这个字符就无法打开文件了。
翻阅古今
相关分类