Generating a Word document using PHPWord
<p>I am generating a Word document using PHPWord, I've open office 3.2.</p>

<p>The Document gets generated but it does not open. When I try to open it, it gives me a error saying that Open office crashed and exits.</p>

<p>Here Goes the code</p>

<pre><code>&lt;?php
require_once '/var/www/word/PHPWord.php';

// New Word Document
$PHPWord = new PHPWord();

// New portrait section
$section = $PHPWord-&gt;createSection();

// Add text elements
$section-&gt;addText('Hello World!');
$section-&gt;addTextBreak(2);

$section-&gt;addText('I am inline styled.', array('name'=&gt;'Verdana', 'color'=&gt;'006699'));
$section-&gt;addTextBreak(2);

$PHPWord-&gt;addFontStyle('rStyle', array('bold'=&gt;true, 'italic'=&gt;true, 'size'=&gt;16));
$PHPWord-&gt;addParagraphStyle('pStyle', array('align'=&gt;'center', 'spaceAfter'=&gt;100));
$section-&gt;addText('I am styled by two style definitions.', 'rStyle', 'pStyle');
$section-&gt;addText('I have only a paragraph style definition.', null, 'pStyle');



// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter-&gt;save('Text.docx');
?&gt;
</code></pre>
