xml from table or section object

Dec 31, 2012 at 6:26 PM

Hi,

i've read all the feedback and questions concerning the ability to load a template and then replace a field with a "table", i can get the template to work perfectly when replacing a word for a variable. However i have needed the ability to "Loop" through a result array, i know this could be done in a long method of using the xml tags, however what would be good would be todo this by using setvalue to replace a "tag" in the template with the contents of a table, eg this example is using examples from other posts here:

 

        $competences = array(
                "Developpement"  => array(
                      "JAVA","PHP","HTML"),

                "Data base"  => array(
                      "ORACLE","MYSQL","DATABASE"),

                "Framework"  => array(
                      "LIEFRY" ,"STRUTS" ,"NOHETO"
                      )
        );

        $load_file ="C:/wamp/www/adminv3/Template.docx";
        $save_file = 'worddocs/test.docx';
        $this->load->library('word');
        $document = $this->word->loadTemplate('C:/wamp/www/test/file_templates/minutes.docx');

        $tabledoc = $this->word->createSection();


        $section = $this->word->createSection();
           $table = $section->addTable();
           foreach($competences as $cle1 => $valeur1)
               {
                   foreach ($valeur1 as $cle2=>$valeur2)

                   {
                    $table->addRow();
                    $table->addCell(1750)->addText("$cle1,$valeur2");
                   }
               }
    //    print_r($table);
        echo $document->writeDocumentRels($section);
        echo $this->word->_documentXML;
        echo $document->_documentXML;
        exit;

 

  $document->setValue('date', $table);

 

The issue is that $table is still an object, is there a way to get the xml of that table or section object?

You can see i've tried playing with it