php - how can i programatically open a docx file, edit it, and then seal it up again without it breaking? -


i have web application converts microsoft word documents html using libreoffice. has been working great, having issues ability interpret indentation on files.

using suggestions other kind developers, have discovered how pull apart docx file converting zip, unzipping it, , extracting document.xml file. in process, have noticed libreoffice consistently incapable of interpreting <w:tab> tags , rendering them indentations.

i have tried many things fix this, running out of ideas. last ditch effort going to use php programatically replace of <w:tab> tags <w:ind> tags (which libreoffice interprets tabs). however, convert file .zip bash unable seal docx. mean, can it, libreoffice no longer recognizes , throws strange error @ me.

is there way can html rendering pulling document.xml file? if not, know how seal these documents again? appreciated. thanks!

here update: seems when try zip docx including parent directory. think messing file when convert docx format. cant seem figure out how zip of contents of folder without zipping folder well. ideas? here code far:

cp mydoc.docx mydoc.zip unzip -d mydoc mydoc.zip zip -r my_edited_doc mydoc/* 

i have found answer! accomplish modifications , rezip file, make sure not including parent directory of zipped files. this, changed directories parent directory , ran following code:

zip -r mydoc ./* 

the full code looks this:

cp mydoc.docx mydoc.zip unzip -d mydoc mydoc.zip cd mydoc zip -r mydoc_converted ./* 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -