This article mainly introduces the method of PHP to read Word documents, analyzes the opening of COM components, property settings and the operation skills of opening and reading Word documents based on COM components, and needs friends to refer to the following
Specific as follows:
The PHP development process may be a Word document reading problems, where you can take advantage of COM components to complete this operation
First, open the php.ini com, the operation is as follows
1.
Extension=php_com_dotnet.dll
2.
Com.allow_dcom = True
Second, after opening, you can try the following actions
1. Create an index that points to the new COM component
$word = new COM ("Word.Application") or Die ("Can ' t start word!");
2. Displays the version number of the word that is currently in use
echo "Loading Word, v. {$word->version}";
3, set its visibility to 0 (false), if you want to make it open in the forefront, use 1 (true)
$word->visible = 0;
4. Open a document
$word->documents->open (DirName (__file__). " /1.doc ");
5. Read the contents of the document
$test = $word->activedocument->content->text;
6. Output document Content
Echo $test;
Related recommendations:
Python reads the text content in Word
PHP Read Word document method sharing
PHP reads Word documents and shows _php tutorials through the Baihui Web API