2 ini_set('include_path', __DIR__ . '../../..');
3 require_once 'Document/Word/Writer.php';
6 $PHPWord = new Document_Word_Writer();
8 // New portrait section
9 $section = $PHPWord->createSection();
12 $table = $section->addTable();
14 for($r = 1; $r <= 10; $r++) { // Loop through rows
18 for($c = 1; $c <= 5; $c++) { // Loop through cells
20 $table->addCell(1750)->addText("Row $r, Cell $c");
25 require_once 'Document/Word/Writer/IOFactory.php';
26 $objWriter = Document_Word_Writer_IOFactory::createWriter($PHPWord, 'Word2007');
27 $objWriter->save('BasicTable.docx');