php - phpWord - Tables with borders in headers/footers -


i working phpword , bringing changes header/footer content gives me real hard time. trying have header content arranged in table. table created through code write. styles try apply table placed in header not take effect.

following part of code in may making mistake.

$phpwordobj = new phpword();     $section = $phpwordobj->addsection();      $styletable = array('bordersize' => 18, 'bordercolor' => '006699');     $phpwordobj->addtablestyle('my custom style', $styletable);      //add header document     $header = $section->addheader();     $header->firstpage();     $table = $header->addtable();     $table->addrow(); //logo     $table->addcell(2000)->addimage(         '../vendor/phpoffice/phpword/samples/resources/phpword.png',         array('width' => 80, 'height' => 80, 'align' => 'left')     ); //logo     $cell = $table->addcell(7000);     $textrun = $cell->addtextrun();     $textrun->addtext(htmlspecialchars('custom name goes here...'));      $headergen = $section->addheader();     $tablegenheader = $headergen->addtable();     $tablegenheader->addrow(); //logo     $tablegenheader->addcell(2000)->addimage(         '../vendor/phpoffice/phpword/samples/resources/phpword.png',         array('width' => 80, 'height' => 80, 'align' => 'left')     );       $cellgenheader = $tablegenheader->addcell(7000);     $textrungenheader = $cellgenheader->addtextrun();     $textrungenheader->addtext(htmlspecialchars('custom name goes here...')); 

all want borders appear header contents can differentiated each other.

thanks!

the $phpwordobj->addtablestyle(...) adds new table style need reference in table addition (i.e. not global definition). adding style name parameter addtable calls should trick:

$table = $header->addtable('my custom style'); 

Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

SQL Server - MyCTE query based on 24 hour period (next day) -