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を使用しています