Hi, when we call class getdocxproperties, return data was the same for each docx also with empty docx.... 12 pages, 307 words, 1690 characters, 14 lines, 3 paragraphs etc .
Where are real stats?
thanks
Hi, when we call class getdocxproperties, return data was the same for each docx also with empty docx.... 12 pages, 307 words, 1690 characters, 14 lines, 3 paragraphs etc .
Where are real stats?
thanks
Hello,
The getDocxProperties method returns the information from the XML properties in a DOCX document. These values are fixed and saved in the DOCX document by MS Word or LibreOffice (phpdocx doesn't change them), so if you read them directly they may not correspond with the real contents.
If you want to calculate the pages, lines and other values dynamically from a DOCX document you need to use the getStatistics method (https://www.phpdocx.com/api-documentation/format-conversion/get-Word-statistics-content). Please check the docs (macros-libreoffice since phpdocx 10) folder included in the package, where you can read all information about this method and how to use it.
You can get statistics too (not number of page/line values) using Indexer (https://www.phpdocx.com/api-documentation/docxutilities/indexer-parse-word-documents-with-PHP) or the getDocxPathQueryInfo method that only requires PHP: number of paragraphs, images, tables...
Regards.
we've added the macro in xba but when we call getsatistics return failed to open stats file...
Hello,
If the statistics file is not generated is because the conversion plugin based on LibreOffice is not correctly configured or the macro has not been added to the correct path (maybe you have added it to other user or HOME folder).
We recommend you to to follow these steps:
1. Check that the conversion plugin based on LibreOffice is correctly installed and it works using PHP CLI mode and the web server:
https://www.phpdocx.com/documentation/conversion-plugin/conversion-plugin-installation-and-set-up
https://www.phpdocx.com/documentation/conversion-plugin/debugging-libreoffice
2. Get the HOME path of the user that will use the macro and add it to the correct Module1.xba file (as explained in the documentation included in the package).
Please follow the previous steps. This feature is used daily by thousands of users without issue; if the stats file is not generated, the problem is always that the conversion plugin based on LibreOffice is not configured correctly or the macro has not been added correctly.
Regards.