0

I have been wondering how I can edit Doc or Docx files in PHP or would it be easier to convert to a different format what would I use and how. I already know that Doc files are Binary and docx are zip and XML docs etc.

I have already tried this and a fiew others that I cannot remember and it just downloaded (something I don't want to do) the docx file.

What should I use?
What libary works with what editor?

Thanks!

Community
  • 1
  • 1
Bad_1nternet
  • 11
  • 1
  • 7
  • You didn't tell us what you are trying to do ;-) Could you be a bit more specific? Then we may be able to tell you whether you might use docx format or another format. – Dirk Vollmar Nov 23 '16 at 08:23
  • 1
    You'll need a specific library to read and edit Word documents in PHP, such as [PHPWord](https://github.com/PHPOffice/PHPWord) for example. – roberto06 Nov 23 '16 at 08:37
  • What library works with what editor and or Code to work with the library atm i dont understand them sorry – Bad_1nternet Nov 23 '16 at 10:36
  • Are you looking for a templating engine for docx ? Have you tried : https://github.com/open-xml-templating/docxtemplater (written in javascript by myself) ? – edi9999 Dec 02 '16 at 16:50

1 Answers1

0

Well generally it is a bad idea to try to edit binary files by yourself.

Why not try any library implementing Word file editing?

e.g. check out https://github.com/PHPOffice/PHPWord

Sloothword
  • 349
  • 1
  • 10
  • The other option is to avoid microsoft and run a headless libra Office. Not sure if there is a good php library? – hayres Nov 26 '16 at 13:02