【发布时间】:2013-11-14 16:07:12
【问题描述】:
我已按照 Codeigniter here 中有关安装 PHPWord 的所有说明进行操作
我只是不知道在哪里可以找到我的输出文件 (filename.docx) 以及如何知道它是否正常工作。没有错误信息。
这是我的代码:
$PHPWord = $this->word; $section = $PHPWord->createSection(array('orientation'=>'landscape')); $section->addText('Hello World!'); $section->addTextBreak(2); $section->addText('I am inline styled.', array('name'=>'Verdana', >'color'=>'006699')); $section->addTextBreak(2); $PHPWord->addFontStyle('rStyle', array('bold'=>true, 'italic'=>true, >'size'=>16)); $PHPWord->addParagraphStyle('pStyle', array('align'=>'center', >'spaceAfter'=>100)); $section->addText('I am styled by two style definitions.', 'rStyle', >'pStyle'); $section->addText('I have only a paragraph style definition.', null, >'pStyle'); $filename='kem.docx'; //save our document as this file name header('Content-Type: application/vnd.openxmlformats->officedocument.wordprocessingml.document'); //mime type header('Content-Disposition: attachment;filename="'.$filename.'"'); //tell >browser what's the file name header('Cache-Control: max-age=0'); //no cache $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); $objWriter->save('php://output');
顺便说一句,我使用的是 ubuntu 12.04 LTS
【问题讨论】:
-
错误是什么?我认为它位于您的控制器目录中。
-
没有错误..我找不到任何错误..我只是找不到我的文件..我检查了控制器文件夹,仍然没有 .docx 文件
-
那么你的脚本没有生成任何东西。当你转储
$objWriter时它会说什么
标签: codeigniter phpword