5

I have search for this on SO but all posts relating to the issue seem to require the installation of software (like the Zend framework or PHPdocx) on the server - which I am not able to do.

I need to be able to read and update text in templates from .doc files. I can achieve this using PHPWord but it only works with .docx. I have contacted the developer of PHPword about the issue but support for .doc is very unlikely.

If there was a way to achieve this using PHP, that would be fantastic. Perhaps there is an internet application with an API which I could use to convert my files using PHP (Google Docs?) but none that I have found.

Perhaps the Google Docs API would help but I have no idea how that is used.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Joshua Bambrick
  • 2,669
  • 5
  • 27
  • 35
  • You could do the DOC parsing yourself, re-inventing PHPdocx. The real boundary here is not "how to do it", but removing whatever barrier is preventing you from installing the proper libraries. – Lightness Races in Orbit Feb 28 '12 at 14:36
  • I would have literally no idea how to do that – Joshua Bambrick Feb 28 '12 at 14:37
  • If you know why you can't install the library, then you should be able to work out how to solve that problem. – Lightness Races in Orbit Feb 28 '12 at 14:38
  • `Perhaps the Google Docs API would help but I have no idea how that is used.` Perhaps. More research required, then. – Lightness Races in Orbit Feb 28 '12 at 14:39
  • I looked into it. All the information refers to the Zend Framework. – Joshua Bambrick Feb 28 '12 at 14:43
  • I don't really understand your comment 'If you know why you can't install the library, then you should be able to work out how to solve that problem.' I cannot install the library because my host doesn't allow me to install software on the server. – Joshua Bambrick Feb 28 '12 at 14:44
  • Then it's time to change to a server that provides the control and functionality that you need. Or have you tried just asking them to install this PHP extension? – Lightness Races in Orbit Feb 28 '12 at 16:20
  • They I don't think such drastic measures as moving away from this host are necessary when I there may well be better and simpler options to explore – Joshua Bambrick Feb 28 '12 at 17:09
  • It's hardly drastic. It's using the correct tool for the job. Clearly you do not have sufficient latitude to implement the tools that you want to implement, so you should use a setup that has more flexibility. That's the real issue here. Sure, you could use some inferior solution to hack around the fact that you're lacking access to install third-party libraries, and that might "work okay" for a while, but then in a few months' time you'll need to do it again. And then again, and then again. Before you know it, your entire application is a mess of inferior reinventions of existing libraries. – Lightness Races in Orbit Feb 28 '12 at 17:15
  • 1
    Why would I need to redo it? Why must that such a solution be inferior? I think that '_the_ correct tool' is jumping to the conclusion that other equally valid solutions do not exist. You may be right but I see no reason why I should jump to dismiss the possibility that there may be better or equally viable ways to perform the same task. – Joshua Bambrick Feb 28 '12 at 22:11

1 Answers1

0

I have decided to just support .docx and if I can find some way of converting to .doc I will include that (but I have not found a way yet)

Joshua Bambrick
  • 2,669
  • 5
  • 27
  • 35