Forum


Replies: 5   Views: 5253
Addtemplate() not working in the pro trial
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 chokehold  · 06-11-2014 - 21:26

Hello We are in the process of buying a pro licens of phpdocx, but before jumping on-board i figured trying it first would be nice. We need to create documents based on a docx template, replacing variables with text from our database. However when i call the addTemplate method i get an error saying: Call to undefined method CreateDocx::addTemplate(). As far as i can see, the trial i downloaded is a PRO trial and looking at your feature table, template manipulation should be included ? I already made all my code to to generate the documents. If i only have to buy the PRO license to get that feature its no problem. Just want to make sure, that the licens we buy satisfies our needs. Yours Dennis T. Holm

Posted by chokehold  · 06-11-2014 - 22:20

I also tried with the createDocxFromTemplate method. Returned: Class 'createDocxFromTemplate' not found After that i thought my include of CreateDocx had failed .. so i tried to make a simple test by creating a document from scratch and just inserted a simple text. That worked fine ???

Posted by chokehold  · 06-11-2014 - 22:22

Even more confusion ... tried to run the example for replaceVariableByText .. and that produced a docx as expected.. so now im even more confused..

Posted by chokehold  · 06-11-2014 - 22:27

My Code which is placed inside DbHandler class: $docx = new createDocxFromTemplate('../documents/kvalitetshaandbog.docx'); $variables = array('virksomhedsnavn' => 'Text which is inserted'); $options = array('parseLineBreaks' =>true); $docx->replaceVariableByText($variables, $options); $docx->createDocx('../documents/example_replaceVariableByText_1');

Posted by admin  · 07-11-2014 - 09:43

Hello, Please check you require CreateDocx to autoload all class and try to write CreateDocxFromTemplate instead of createDocxFromTemplate. Maybe your PHP is configured to the use of mandatory uppercase. Regards.

Posted by chokehold  · 07-11-2014 - 11:32

Foolish mistake. Needed capital C in CreateDocxFromTemplate .. Thanks for the help .. sometimes you simply cant see the forest because of all the trees :-) Anyways.. your library is so far impressive.. saved a lot of time and everything seems simple, intuitive and well documented.