Forum


Replies: 3   Views: 4095
Blank or corrupted word documents on new server
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 OGTadmin  · 11-04-2013 - 12:13

Thanks. Based on this help, I am posting my solution for anyone else who may encounter the same Temp directory access rights issue.

A modified List.php example is shown below. I initially had problems with this solution because I only used the relative template path and not the relative path to the actual template [u]document file[/u] in the constructor.

My full solution also involved creating a docx and Temp directory under the examples directory:

v2.5.1/examples/docx
v2.5.1/examples/Temp

The new Word document is created in the docx directory. Note that I later moved the Temp directory to a better location for our server. Also note that your custom code files will likely have different relative paths than the example projects.

[code]

<?php

/**
* Insert an unordered list into a Word document.
*
* @category Phpdocx
* @package examples
* @subpackage easy
* @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
* (http://www.2mdc.com)
* @license http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
* @version 1.8
* @link http://www.phpdocx.com
* @since File available since Release 1.8
*/
require_once '../../classes/CreateDocx.inc';

$docx = new CreateDocx("../../templates/phpdocxBaseTemplate.docx", "../Temp");

$valuesList = array(
'Line 1',
'Line 2',
'Line 3',
'Line 4',
'Line 5'
);

$paramsList = array(
'val' => 1
);

$docx->addList($valuesList, $paramsList);

$docx->createDocx('../docx/example_list');


[/code]