【发布时间】:2017-06-22 12:00:14
【问题描述】:
我正在尝试使用 phpword addObject() 函数将 .docx 文件附加(嵌入)到 word 文档,它正在附加文件,但是在单击附加文件时它没有打开。如果我为 .doc 文件执行此操作,则会打开附件。我正在使用 phpword 库。
<?php
require_once '../PHPWord.php';
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Add text elements
$section->addText('You can open this OLE object by double clicking on the icon:');
$section->addTextBreak(2);
// Add object
$section->addObject('Test.docx');
//if i use $section->addObject('Test.doc'); it's opening attached file. here Test.doc is word97-2003 format.
// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('Object.docx');
?>
【问题讨论】:
-
分享你的代码
-
抱歉,现在添加代码。