Forum


Replies: 3   Views: 4311
Multi-line text
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 nikkyb8  · 18-11-2013 - 18:22

Hello,



I tryto usethis function:

CreateDocx$docx= new();

$docx->AddTemplate('/var /www /docx/ examples/ files /test_template_moi.docx');



$ text= array (

     'DavidHume'

     '-----------'

     'Bye'

);



$docx->addTemplateVariable('NAME',$ text);





$docx->cleanTemplateVariable('VARIABLE', 'block');

$docx->createDocxAndDownload('/tmp /' $_SESSION["username"]'_'$ _SESSION["user_id"]'/''sss'.....)



But with:

  $ Text= array (

      'DavidHume'

      '-----------'

      'Bye'

);

Itdoes not work anymore....

How to displaythe textin multiline?


Posted by nikkyb8  · 18-11-2013 - 18:33

Okit wasjustnot tojumponline soit works

$ text= array ('11 ','22');

Can you help meto do thisdynamicallybecause when Idid this:

$donneesss='111111,22222;

$optionsCochees= explode(',', $donneesss);

foreach ($optionsCocheesas $option) {

$sss[] = $option;

}

$aData[]= array ('designation' => $sss,'qty' =>$ data["Quantity"],pu '=>$ data["prix_unitaire"].' € ',' ht'=>$ data["ht"] '.');

It gives methefollowing error:



Warning:htmlspecialchars()Expectsparameter 1tobestring, arrayGiven in/ var/ www /docx/ classes /CreateTemplate.incon line1639



Do you knowwhat's the reason?


Posted by jorgelj  · 19-11-2013 - 09:04

Hello,



In



$docx->addTemplateVariable ('NAME', $text);



You can't add a multimensional array, only an array. Of course you can use the replaceTemplateVariableByHTML method to do that.



Regards.