<?php
include('PHPWord.php');
header('Content-Type: application/msword');
header("Content-Disposition: attachment; filename=\"test.docx\"");
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$section->addText('aaa', null, array('spaceAfter' => 0));
$section->addTextBreak(1, null, array('spaceAfter' => 0));
$section->addText('bbb', null, array('spaceAfter' => 0));
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('php://output');
可以在此处找到创建的Word文档:
http://www.frostjedi.com/terra/test.docx
在Microsoft Word中,如果单击空行然后打开段落对话框,您将看到间距 - &gt;值为8pt后(我希望它为0pt)而对于aaa线和bbb线,它是0pt(如预期的那样)。
我正在使用Beta 0.6.3。
有什么想法吗?