Hello,
The method replaceTableVariable allows to add any values in a table; but it doesn't allow to add values then a header in the same table then values again... and so on.
You'll need to generated distinct tables for each set of values or generate the tables dynamically (using addTable or embedHtml or replaceVariableByHTML).
The next version of phpdocx will include, only for Corporate and Enterprise licenses, a new class called DOCXPATH that will ease tasks that the one you need.
Regards.