[root@zetawiki ~]# cd /usr/share/php/
[root@zetawiki php]# ll htmltodocx*
-rw-r--r-- 1 root root 623496 Sep 9 13:06 htmltodocx_0_6_5_alpha.zip
[root@zetawiki php]# unzip htmltodocx_0_6_5_alpha.zip -dhtmltodocx
... (생략)
inflating: htmltodocx/simplehtmldom/manual/manual_faq.htm
inflating: htmltodocx/simplehtmldom/simple_html_dom.php
inflating: htmltodocx/example.php
[root@zetawiki php]# ll | grep htmltodocx
drwxr-xr-x 7 root root 4096 Sep 9 13:08 htmltodocx
-rw-r--r-- 1 root root 623496 Sep 9 13:06 htmltodocx_0_6_5_alpha.zip
[root@zetawiki php]# rm -f htmltodocx_0_6_5_alpha.zip
[root@zetawiki php]#
[root@zetawiki php]# cd
[root@zetawiki ~]# vi test1.php
<?php
require_once 'htmltodocx/phpword/PHPWord.php';
require_once 'htmltodocx/simplehtmldom/simple_html_dom.php';
require_once 'htmltodocx/htmltodocx_converter/h2d_htmlconverter.php';
$html = '<html>
<body>
<h1>Hello 친구들</h1>
<ul>
<li>하나</li>
<li>둘</li>
</ul>
<table>
<tr><td>1</td><td>한놈</td></tr>
<tr><td>2</td><td>두시기</td></tr>
<tr><td>3</td><td>석삼</td></tr>
</table>
</body>
</html>';
$html_dom = new simple_html_dom();
$html_dom->load($html);
$html_arr = $html_dom->find('html',0)->children();
$phpword = new PHPWord();
$section = $phpword->createSection();
$state = array(
'phpword_object' => &$phpword,
);
htmltodocx_insert_html($section, $html_arr[0]->nodes, $state);
$objWriter = PHPWord_IOFactory::createWriter($phpword, 'Word2007');
$objWriter->save('sample1.docx');
[root@zetawiki ~]# php test1.php
[root@zetawiki ~]# ll sample1.docx
-rw-r--r-- 1 root root 8526 Sep 1 15:01 sample1.docx