ok in my template add a table of content from Word but nothing happeng But if I add $docx->addTableContents update the table of content but is add another table of content at end of document
//variable is just a example
$docx = new Phpdocx\Create\CreateDocxFromTemplate('Informe.docx');
$docx->replaceVariableByHTML('clienteNombre', 'inline', $variable, $estiloHtml);
$docx->replaceVariableByHTML('Propuesta', 'inline', $variable , $estiloHtml);
$docx->replaceVariableByText(array('PortadaNombreProyecto' =>$variable), array());
$org = $something;
if($org ){
$docx->replaceVariableByHTML('ORG', 'block', $variable, $estiloHtml);
}else{
$docx->deleteTemplateBlock('ORG');
}
$docx->addTableContents(array('autoUpdate' => true), $legend);
$docx->clearBlocks();
$legend = array(
'color' => 'B70000',
'bold' => true,
'fontSize' => 12,
'pageBreakBefore' => true
);
$docx->addTableContents(array('autoUpdate' => true), $legend);
/* Le damos un nombre random */
$nombreInforme = "Poch_".str_replace(" ", "_", $variable)."_".date("Y-m-d");
/* Obligamos a que descargue */
$docx->createDocxAndDownload($nombreInforme);