Forum


Replies: 3   Views: 3714
Slow document generation from template using tables and replacevariablebyhtml
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 dthomas41  · 28-07-2015 - 02:23

We are currently evaluating phpdocx for replacing paper forms. The solution so far involves a ~15 page template containing mostly tables. Each cell contains parsed HTML data which will eventually come from ckeditor web forms. We're using replaceTableVariable and replaceVariableByHTML, so this is possibly not the most efficient way of using templates. Currently my code takes 30+ seconds to generate a document. We are using the demo version to decide whether the product is worth purchasing. What sort of performance improvement, if any, would be expected with the full version? I noticed that most of the execution time comes from StyleParser and DOMDocument

Posted by admin  · 28-07-2015 - 07:39

Hello, The transformation from HTML to WordML is complex. If you're using huge HTML code we recommend you to split the HTML in two or more chunks instead of adding it in just one embedHtml execution, or use a server with better performance (SSD, Xeon, more RAM...) There's also a post about phpdocx performance: http://www.phpdocx.com/news/post/phpdocx-3-5-general-performance-benchmark/195 As you can see it's really fast. Regards.

Posted by dthomas41  · 28-07-2015 - 23:29

Hi admin, The benchmark post does not address API relating to templates and is for an unsupported version of phpdocx which is nearly two years old. E.g. the createWordMLFragment function used frequently in the post no longer exists. You also did not answer my question about the performance of the demo version of phpdocx.

Posted by admin  · 29-07-2015 - 07:36

Hello, The performance differences between trial and pro packages are minimal. About the post, we were just pointing out a benchmarking post. The createWordMLFragment class doesn't exist but the WordFragment class is very similar. Phpdocx 4 is faster than phpdocx 3 but that post can be used as reference. Regards.