This project is read-only.

not working word.php just show blank page


Dear All,
please help me to start work this project. i can not start. when run the word.php file then only blank page shown. i want to make a web based word processor like google document. but the white working area cannot design. so plz help me.


amok211 wrote Feb 12, 2015 at 10:53 AM

Same here.

I had been struggling with OpenTBS, and managed to generate .odt docs, although not achieveing exactaly what I wanted. So I've changed to PHPWord, but all I got is a blank screen. Besides, PHP debugging is kind of hell, so I don't truly know what's wrong with my code. As far as I know, if you are using a template, you won't need to add sections. My code looks like this:

      //Retrieve posted data
      $title = $_POST['title'];
      $msg = $_POST['msg'];  
      $name = $_POST['name'];
      $format = $_POST['format'];

      //check if retrieved data is ok
      echo ("<p> title: " + $title + "</p>");
      echo ("<p> msg: " + $msg + "</p>");
      echo ("<p> name: " + $name + "</p>");  

      //Include PHPWord
      $require = require_once '../librerias/PHPWord/PHPWord.php';

      //Instance PHPWord object
      $PHPWord = new PHPWord();

      //Load Template (same directory as this .php file)
      $document = $PHPWord->loadTemplate('test.docx');

      //Replace template fields 
      $document->setValue('title', $title);
      $document->setValue('msg', $msg);
      $document->setValue('name', $name);
      $document->setValue('weekday', date('l'));