1

i want to read content of Doc file or convert a doc file into Docx

I have used COM object but it's not working because i've linux based server.

I have also tried with shell_exec command but it doesn't work because there's no any feature provide on shared server .

is there any api ? so that i can convert a Doc file using Docx

Sourabh Jain
  • 11
  • 1
  • 2
  • If my answer sufficiently solved your question, remember to accept it. If it hasn't solved your question, tell me what's missing and I'll try to help! – Jeff Gortmaker Nov 01 '12 at 01:47

1 Answers1

0

If you want to use PHP, try out PHPWord.

There's an example on how to convert from .doc to .docx on this page:

require_once '../PHPWord.php';

$PHPWord = new PHPWord();

$document = $PHPWord->loadTemplate('Excel2003.doc');

// Save File

$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');

$objWriter->save('Excel2007.docx');

Jeff Gortmaker
  • 4,607
  • 3
  • 22
  • 29
  • 1
    The page you link to says the opposite of what you're saying--neokasp writes: "cindydolan's answer will not work because the loadTemplate uses xml and which is contained in docx file and not doc file." This is confirmed by my tests. Answers at http://stackoverflow.com/questions/7358637 also claim that PHPWord does not support `.doc` at all, and I see no evidence to the contrary. – Val Kornea Dec 17 '14 at 20:27
  • PHPWord is currently a tool to create word processing files in several file formats (in contrast to PHPExcel, its older sibling, that can read & write many formats) I just read an April 2014 dialog between developers working on the ability for PHPWord to read files in the formats that they write. Some users have asked for a doc (Word2003) reader in addition to the other readers. They debated the need, In the end, added it to the project. They are asking for contributions in the form of existing open source code in any language they can use as a starting point for the PHP effort – Ted Cohen Jan 23 '15 at 11:01