2

I know that PHPWord library can create a word file, But,Is it possible read word file with PHPWord? If yes, how? I saw many answers in this site about reading a word file with php. The answers was "PHPWord", one of these answers is this. But couldn't find how it's possible. I searched in PHPWord officcial site but no result.

Community
  • 1
  • 1
Qaren
  • 21
  • 1
  • 2

2 Answers2

1

You should have a look at this question: read word document in php

It provides some insides on how to read a docx-document in PHP.

Community
  • 1
  • 1
Jeroen Moors
  • 981
  • 8
  • 11
0

The answer is a simple "No". PHPWord doesn't read word documents (though it can read basic style information from a template), only writes them.

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • 1
    Thanks, how can i read word file with php? i want to parse word/document.xml with simplexml_load_file, but it's empty. I want read not only the content, i want to know which tag the text in? Sorry my english. – Qaren Mar 27 '13 at 13:13
  • 1
    This is incorrect. [PHPWord](https://github.com/PHPOffice/PHPWord) itself says: "PHPWord is a library written in pure PHP that provides a set of classes to write to *and read from* different document file formats." – Lincoln Bergeson Jan 31 '17 at 21:00
  • @LincolnBergeson - It was correct at the time when the answer was written, nearly 4 years ago: I apologise that PHPWord has been developed further since then to support reading as well... memo to self, don't bother adding new functionality to PHPOffice – Mark Baker Jan 31 '17 at 21:19
  • 1
    @MarkBaker Didn't mean to sound harsh. I just put that there for future readers. No ill will intended :-) – Lincoln Bergeson Jan 31 '17 at 23:58