Forum


Replies: 4   Views: 915
Unable to view real stats file
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by giampo  · 27-08-2021 - 11:13

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

Posted by admin  · 27-08-2021 - 11:28

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.

Posted by giampo  · 27-08-2021 - 13:29

Deleted by giampo · 27-08-2021 - 15:18

Posted by giampo  · 27-08-2021 - 15:19

we've added the macro in xba but when we call getsatistics return failed to open stats file...

Posted by admin  · 27-08-2021 - 16:24

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.