Quantcast
Channel: PHPWord
Viewing all articles
Browse latest Browse all 450

New Post: Table cell - horizontal align?

$
0
0
I was able to center the contents of my table cells like this:
$center = array('spaceAfter' => 0, 'align' => 'center');

$table_block_format = array(    'borderSize'        =>  7,
                                'cellMarginTop'     =>  0,
                                'cellMarginLeft'    =>  100,
                                'valign'            =>  'center',
                                                                );

$cellTextStyleBig = array(      'bold'  =>  false, 
                                'size'  =>  22, 
                                'name'  =>  'Calibri'
                                                        );

$cellTextStyleBigBold = array(  'bold'  =>  true, 
                                'size'  =>  22, 
                                'name'  =>  'Calibri'   
                                                        );      

$PHPWord->addTableStyle('myTable', $table_block_format, array('align' => 'center'));

$table = $section->addTable('myTable');
$table->addRow();
$table->addCell(1460)->addText('Size:', $cellTextStyleBigBold, $center);
$table->addCell(3560)->addText('Text Is Centered', $cellTextStyleBig, $center);

Viewing all articles
Browse latest Browse all 450

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>