Forum


Replies: 7   Views: 3310
Creating more than one docx results in corrupt 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 hchandler  · 11-04-2013 - 12:13

One other note. I created a simple php script like the below that created three docx files. This DID work. However these simple examples don't really say that much because they don't reflect the real world when other things are going on in memory (like the SQL calls in the real functions).

$docx = new CreateDocx();
$docx->addTemplate('doc_gen/exclusivity_template_subs.docx');
$docx->addTemplateVariable('TITLE', "the title");
$docx->addTemplateVariable('REQ', "123 - 4567");
$docx->createDocx("doc_gen/subs/TEST_A");

$res_docx = new CreateDocx();
$res_docx->addTemplate('doc_gen/resume_template_subs.docx');
$res_docx->addTemplateVariable('TITLE', "another title");
$res_docx->addTemplateVariable('REQ', "456-2344");
$res_docx->createDocx("doc_gen/subs/TEST_B");

$docx = new CreateDocx();
$docx->addTemplate('doc_gen/position_template_subs.docx');
$docx->addTemplateVariable('TITLE', "title again");
$docx->addTemplateVariable('DEADLINE_DATE', "the date");
$docx->addTemplateVariable('NUM_POSITIONS', "23");
$docx->addTemplateVariable('START_DATE', "12-23-22");
$docx->addTemplateVariable('END_DATE', "01-31-11");
$docx->addTemplateVariable('REQ_NUMBER', "12");
$docx->addTemplateVariable('MAX_RATE', "$"."130000");
$docx->addTemplateVariable('short_description', "This is the short description");
$docx->addTemplateVariable('long_description', "This is the long one",'html');
$docx->createDocx("doc_gen/subs/TEST_C");