Forum


Replies: 2   Views: 3515
Adding a row in a table
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by kshaikh  · 23-09-2013 - 04:28

Hi,



I am trying to add a row in a table created using addTable api. Following is my code:



<?php 

//require_once '../phpdocxpro/classes/CreateDocx.inc';

require_once '../phpdocx3.5/classes/CreateDocx.inc';

//722=0.5 inch 

$docx = new CreateDocx();



$docx->modifyPageLayout('A4', array('marginTop' => '722', 'marginRight' => '722', 'marginBottom' => '722', 'marginLeft' => '722'));



$paramsTable = array(

    'border' => 'none',

    'jc' => 'center',

    'border_sz' => 10,

    'size_col' => array(10583),

    'float' => array('align' => 'right','textMargin_top' =>0,'textMargin_right'=>43,'textMargin_bottom' =>0,'textMargin_left' =>43),

    'tableWidth' => array('dxa',10583)

);



$paramsTextTable[0] = array(

    'text' => 'MARIA DOW',

    'b' => 'none',

    'jc' => 'right',

    'font' => 'Times New Roman',

    'sz' => 13

    );



$paramsTextTable1[0] = array(

    'text' => '110th Street, New York, NY 10025',

    'jc' => 'right',

    'font' => 'Times New Roman',

    'sz' => 10

    );



$table[] = array(

    $docx->addElement('addText', $paramsTextTable),

    $docx->addElement('addText', $paramsTextTable1)

);



$docx->addTable($table, $paramsTable);



$docx->createDocx('table2');

?>



I want the address to appear in the row following the first row. However, it appears as a second column in the first row itself. What am I missing?



Please advice.



Thanks in advance.