Forum


Replies: 2   Views: 3759
Addelement method
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 gp92300  · 07-01-2011 - 11:40

Hi,

PHPDOCX PRO works fine on my webserver. But I can't use both addElement and addTable at the same time.
Can you tell me what is wrong ? Here's my code.

[code]require_once '../3rd-party/phpdocx/classes/CreateDocx.inc';

// instantiation
$docx = new CreateDocx();
$docx->setDefaultFont('Arial');
$docx->setEncodeUTF8();

$paramsText = array(
'text' => 'Epreuve de votre notice biographique',
);
$a1 = $docx->addElement('addText', $paramsText);

$a2 = '';

$paramsText = array(
'text' => 'TEXTE (insertion GRATUITE) PHOTO ou LOGO (voir tarif).',
);
$b1 = $docx->addElement('addText', $paramsText);

$paramsText = array(
'text' => 'Réservation',
);
$b2 = $docx->addElement('addText', $paramsText);


$valuesTable = array(
array(
$a1,
$a2,
),
array(
$b1,
$b2,
),
);

$paramsTable = array(
'TBLLOOKval' => 'ffff01E0',
'TBLSTYLEval' => 'Tablanormal',
'TBLWtype' => 'center',
'TBLWw' => '50',
'border' => 'single',
'border_sz' => 1,
'border_spacing' => 0,
'border_color' => 'CCCCCC',
'jc' => 'left',
'size_col' => 3600
);

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

$fileName = 'bat_simple';

$docx->createDocx($fileName);
[/code]