Forum


Replies: 12   Views: 4532
Replace template variable with wordml
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 ludalex  · 10-01-2014 - 22:20

Hello,



I'm in desperate need for this feature as I need to replace template variables with tables generated with addTable(). replaceVariableByHTML() doesn't work as good.



Please PHPDOCX staff, I can't believe you have methods to replace variables by whole .docx documents and not one to do replace it with WordML :D



Thanks in advance.


Posted by jorgelj  · 12-01-2014 - 09:27

Hello,



What version of PHPDocX are you using?



Regards.


Posted by ludalex  · 12-01-2014 - 13:46

[quote=jorgelj]



Hello,



What version of PHPDocX are you using?



Regards.



[/quote]



3.6 PRO (Trial), gonna buy it soon.



Thanks in advance.


Posted by jorgelj  · 13-01-2014 - 10:52

Hello,



The current version of PHPDocX doesn't allow to replace a variable by WordML, but in the future it will. The solution is to use replaceVariableByHTML. What issue do you find using this method?



Regards.


Posted by ludalex  · 13-01-2014 - 20:31

[quote=jorgelj]



Hello,



The current version of PHPDocX doesn't allow to replace a variable by WordML, but in the future it will. The solution is to use replaceVariableByHTML. What issue do you find using this method?



Regards.



[/quote]



Table generation from HTML loses many features that I strictly need such as "repeat row on each page" and others.


Posted by ludalex  · 13-01-2014 - 22:23

Anyway I solved grabbing the return value of addTable() and str_replace()ing it in the document.xml using ZipArchive() if anyone's in interested.


Posted by jorgelj  · 14-01-2014 - 09:34

Hello,



You can get the raw WordML of each method and use addTemplateVariable to add it but it may lose some external dependencies.



Regards.


Posted by ludalex  · 14-01-2014 - 10:06

[quote=jorgelj]



Hello,



You can get the raw WordML of each method and use addTemplateVariable to add it but it may lose some external dependencies.



Regards.



[/quote]



addTemplateVariable() doesn't take WordML as input, I tried and it just pastes WordML in the document without having Word rendering it.


Posted by jorgelj  · 14-01-2014 - 17:45

Hello,



I mean the raw string of the WordML.



Regards.


Posted by ludalex  · 15-01-2014 - 13:01

[quote=jorgelj]



Hello,



I mean the raw string of the WordML.



Regards.



[/quote]



Yeah of course. That doesn't work, have you tried personally and succeded or are you just suggesting?


Posted by jorgelj  · 15-01-2014 - 16:30

Hello,



There's no example of that but it should works. Getting the raw WordML and replacing it.



Regards.


Posted by ludalex  · 16-01-2014 - 14:51

[quote=jorgelj]



Hello,



There's no example of that but it should works. Getting the raw WordML and replacing it.



Regards.



[/quote]



Again, it doesn't :D I tried several times as this is a vital feature for me and it doesn't work. 



But still, maybe I'm stupid :)