Re: Can you Edit docx files with querypath?

32 views
Skip to first unread message

TechnoSophos

unread,
Feb 25, 2013, 11:49:00 AM2/25/13
to support-...@googlegroups.com
Unfortunately, in order to write to these files, you have to unzip the package, change the files, and then re-zip the package. (This is because ZIP streams are not writable; see http://www.php.net/manual/en/wrappers.compression.php)

Other than that, though, DOCX packages are in principle modifiable.

-- 
TechnoSophos
Twitter: @technosophos
Sent with Sparrow

On Sunday, February 24, 2013 at 12:54 PM, Contra Mundi wrote:

I know you can read docx files with querypath, because they are just zipped xml files, but can you actually modify them?

Ive tried to modify but all i get is an Error which says: "Object of Class QueryPath could not be converted to string"

<?php

require 'src/QueryPath/QueryPath.php';

$file = 'zip://test1.docx#word/document.xml';

$doc = qp($file);

foreach($doc->find('w|t') as $item) {
    $chnage = $item->text('Change Text To This');
   
   
}
?>

--
You received this message because you are subscribed to the Google Groups "support-querypath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to support-queryp...@googlegroups.com.
To post to this group, send email to support-...@googlegroups.com.
Visit this group at http://groups.google.com/group/support-querypath?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages