This project is read-only.

addlistitem in a table?

Aug 16, 2010 at 6:52 AM

Hi I am wondering can I add a list item in a table?

It doesn't seem to work.

$table->addCell(2535, $styleCell)->addListItem('0 - 2 years',0, $fontStyle7,$listStyle);

Nov 22, 2011 at 9:59 AM
Edited Nov 22, 2011 at 10:00 AM

Hi,

I have the same problem with this method. This code generates a fatal error

$table = $section->addTable();
$table->addRow(1000);
$cell = $table->addCell(1000);
$cell->addListItem('Item 1', 0);
$cell->addListItem('Item 1.1', 1);

Fatal error: Call to private method PHPWord_Writer_Word2007_Document::_writeListItem() from context 'PHPWord_Writer_Word2007_Base' 

I went into the class "PHPWord_Writer_Word2007_Document" and change the accessibility of the method PHPWord_Writer_Word2007_Document::_writeListItem() to protected and all works fine, my list appear in the table cell.
Is this private accessibility necessary or is it an implementation problem ?

Jul 9, 2013 at 9:39 AM
Hi,

I have the same issue to add a List Item in an Table Cell. Has anybody an Idee?

Thanks!

Kind regards,
Buschdieb
Aug 22, 2013 at 12:03 AM
open file Document.php, line 235

change:
private function _writeListItem
to
public function _writeListItem