|All requests||>||Convert Ms Word to plaint text and co...||>||Request new recommendation||>||Featured requests||>||No recommendations|
by Erick Mongi - 6 months ago (2017-05-04)
The main problems is how to count number of words from ms word 2007(docx format). Current I try to use doc2text to convert ms word to plaintext but display wrong number of words from plaintext that's main problem facing right now. If anyone knew how to count number of words direct from ms word using php library/ scripts that's all I need and helpful to my project. Thanks guys
1. by zinsou A.A.E.Mo´se - 5 months ago (2017-06-25) Reply
Did the plaintext conversion contain the same text according to you? if yes then you can try to count the number of words from it.Otherwise you can use the alternative that you said. In every case, if your conversion succeed with the same text then you can use the package below to count number of words.
First, you need to open the file to allow PHP use this ressource with a function like fopen;then you need to read the file with a function like fgets and affect its content to a variable then you can use the package like this to count number of words: This class got a method which allows to get an array of all the words in a string.The words are indexed so if you need to count them the first way is to see the last index and add 1 since PHP array start indexing at 0 or simply use the function count() of PHP on the array. You can also try https://www.phpclasses.org/package/9952-PHP-Manipulate-UTF-8-text-strings-in-pure-PHP.html