Row segments in odtphp

447 views Asked by At

I'm currently generating some invoices with odtphp. (https://github.com/cybermonde/odtphp)

I made a segment that contains a table which will be dynamic (and therefore also use a segment) so i use the [!-- BEGIN row.segmentname --] and [!-- END row.segmentname --] tags.

My first segment is working but the row segment won't work.

Here's the error it prints:

Fatal error: Uncaught exception 'OdfException' with message ''details' segment not found in the document

Here's the part of the code that's not working:

Has anyone experienced this?

while ($row = mysql_fetch_array($res))
  {
    $segment->setVars("codearticle", $row['codearticle']);
    $segment->setVars("designation2", $row['designation']);
    $segment->setVars("qte", $row['quantite']);
    $segment->setVars("prixvente", $row['prixvente']);
    $segment->setVars("totalpiece", $row['montantvente']);
    $segment->merge();
  }
$odf->mergesegment($segment);

What should I do to make this work?

1

There are 1 answers

0
Scott Froidevaux On

So, after a while of fiddling with my php code, i opened content.xml (from the odt archive) with my text editor and saw that some parts of the text were separated by some xml markups.

I edited it and it seems to find the row tag.

I still have some minor problems, it won't get into my while loop, but at least this part works!