Ze Bra
asked on
How to strip word docx from 'template-fields' after mailmerge?
We have a PHP mailmerge app that unzips docx, substitutes mailmerge fields and zips them back, it all works fine and looks ok when opening. But if i try to print this 'new' document, all fields that were filled after opening, now have error messages in them. To resolve, we have to do ctl-a (select all) and shift-f9 in word and now all data is included and we can print the document.
I am looking for an alternative solution to the ctl-a shift-f9 in word, we are talking about hundreds of documents and although we have a macro solution we are looking at, we'd rather fix this at the php level when mailmerge is still going on.
How could we do this, fe. using the dom-structure of php, maybe disconnecting the fields from the value or something like it.
285_421_2_1_20160816_example.docx
I am looking for an alternative solution to the ctl-a shift-f9 in word, we are talking about hundreds of documents and although we have a macro solution we are looking at, we'd rather fix this at the php level when mailmerge is still going on.
How could we do this, fe. using the dom-structure of php, maybe disconnecting the fields from the value or something like it.
285_421_2_1_20160816_example.docx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Um.... why not just use the PHP to operate on a temporary copy of the document instead of unzipping the original, OR create a backup of the doc and use the PHP TO restore...?
ASKER
Hmm not sure what happened with my previous comment, so i will try again:)
@GrahamSkan, ty i am now looking at SimpleXml for php wich seems capable of doing that. My problem is that xml is not my usual cup of tea i guess but the unlink comment may get me where i need to be, so i will accept your solution.
@DrTribos, yes there is a copy made of the original template, that one is processed, and is the one attached to the questiong, just manually manipulated for privacy reasons.
@GrahamSkan, ty i am now looking at SimpleXml for php wich seems capable of doing that. My problem is that xml is not my usual cup of tea i guess but the unlink comment may get me where i need to be, so i will accept your solution.
@DrTribos, yes there is a copy made of the original template, that one is processed, and is the one attached to the questiong, just manually manipulated for privacy reasons.