TinyButStrong - the PHP Template Engine
Categories > OpenTBS with DOCX >

LoadTemplate slow - optimization

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: matben3
Date: 2016-12-13
Time: 13:00

LoadTemplate slow - optimization

Hi,

I have a docx file that I use for template. It's all text and there aren't subblocks, images or other stuff. It has 8 of 15 pages full of text, it is lika a contract so this part is full of text write with a small character. The problem is that to load this template it use about five minutes. Is this normal? Is there something to do to increase speed? I made tests with 9 pages (only 1 full text) 37 sec, 10 pages 55sec, 13 pages 3 minutes and 34 seconds.

Thank you.
Matteo
By: Skrol29
Date: 2016-12-13
Time: 23:03

Re: LoadTemplate slow - optimization

Hi,

Your DOCX can be slow if you made lot of changes in it.
Here are some explanations, and the solution.

Each time you are editing your DOCX, Ms Word insert some internal invisible markers that allows change monitoring, and collaborative merging. Those markers are RsIDs and OpenTBS has to delete all of them because they can disrupt the inner XML.
But you can delete them yourself easily :

1) Open your DOCX template in Ms Word
2) In Ms Word: go to the « File » tab, « Options », « Trust Center », « Trust Center Settings », in order to display the Trust Center dialog box. Select « Privacy options », and under the  « Document specific Settings » section, and have the « Store Random Numbers to Improve Combine Accuracy » option unchecked.
3) Make a change in your DOCX and save it.
Now your template has no RsID anymore.


The second way to delete RsIDs is to set option $TBS->SetOption('auto_merge', false);, then open the template with OpenTBS, do nothing with it, and then save the result as a new DOCX. This DOCX will have no RsID.

By: matben3
Date: 2016-12-14
Time: 10:31

Re: LoadTemplate slow - optimization

Hi Skrol29,

thanks for your reply. Unfortunatly it doesn't work for me... I try all your solution but the timing of load template is the same. It's 4 minutes and 13 sec, same as the original file...
Could I send you my template to see if there's something else to do? I don't know how to change it more...

Thank you
Matteo
By: Skrol29
Date: 2016-12-14
Time: 23:01

Re: LoadTemplate slow - optimization

Hello,

Yes, please, send your template to me.