Forum


Replies: 3   Views: 3705
Empyt docx files
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 rjonge  · 22-11-2011 - 15:29

Hello,

I just purchased the pro version. (v2.4)

Every document I generate is empty. Even if I try the examples. I did not get any errors. does anybody know what could cause this problem?

for example:

require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText( 'This is a test.' );
$docx->createDocxAndDownload('newFile');

I can download newFile.docx as expected. But it's empty when opening in Word 2007 (windows). If I open the newFile.docx in a other text editor it's also a empty file.

Posted by rjonge  · 11-04-2013 - 12:13

I think I found the problem and solution.

The problem is the standard temp directory where the docx files will be created by phpdocx. When I use it, it will give me empty docx files. I don't know exactly why.

In my own project folder I made a folder 'generetedDocs' with write permissions for apache.

I made the createDocx and createDocxAndDownload methods working with the new path:

$docx->createDocx($_SERVER["DOCUMENT_ROOT"] . '/generetedDocs/example_text');
$docx->createDocxAndDownload($_SERVER["DOCUMENT_ROOT"] . '/generetedDocs/example_text');

now I've good filled docx files!



Posted by admin  · 11-04-2013 - 12:13

Hello,

On a next version of phpdocx we'll add a new method to change temp directory.

Regards.