-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to newer version possible? #2
Comments
I found out how to use the latest version. Copy the folder PhpWord from the downloaded zip file (found in the src folder) to joomlas libraries folder + PhpOffice i.e. libararies/PhpOffice/PhpWord Start e.g. a controller method with
So far everything works except one problem. I had to fix a couple of calls to a String class as I'm on PHP 7. PHPExcel would probably work the same way. I have no idea, if it's interesting to the Joomla community to have an installable library package for those two. |
Hi @schnuti and thanks for looking into this. Since I have not released any updates since 2013, it might be worth investing some time into this. I will let you know. PHPWord for Joomla seems not so popular, but PHPExcel has a decent number of downloads so far - enough to keep me motivated. If you find any problems with PHP7, it might be worth reporting / sending a pull request to the PhpOffice guys. Keep you updated. |
Hi @vdespa, They have solved the PHP7 issue in the development branch. You probably do not want to use that version loose code for a library. So:
I now use the class simple_html_dom to filter out the strings from ul - li lists stored in text fields in the db. Those filtered values are exported and directly downloaded to a .docx file. The user now can edit those "to do lists / shopping lists". Made a lot of fun to code this :) |
I just saw that the code in "PhpOffice/Common" is needed for the next version. i.e. 3 parts in the library libraries/PhpOffice/Common |
Hi @schnuti I have just did some testing using the latest (master) version of PHPWord. You can play with the pre-release: https://github.com/vdespa/PHPWord-Joomla-Library/releases/tag/0.13.0-alpha Just download and install phpword_dist.zip |
I had a look in the zip file. The size is now already 3M ! so I had to increase the sizes allowed in php.ini |
The Zend/Validator package is used. Edit: I added a level libraries/phpoffice/PhpOffice/Common with a modified Autoloader.php in each folder. Only needed files included. Do not ask me why it works (without conflicts) but it seems to.
|
This is an installation file. PhpExcel 1.8 is included but not at all tested. |
I have added another pre-release based on the develop branch. Download and install phpword_dist_develop.zip. It should work only with:
Unfortunately in the first run I cannot do anything about the size. I will try to remove some of the files after the thing is working. Let me know. |
I have now included 3 PhpOffice "parts" in one installation zip. PhpExcel is a very special case, the path is PhpSpreadsheet but the namespace is PhpEdit!? I've tested simple examples with all 3. "Powerpont", "Excel" and "Word". Not quite the Joomla way: I have for each example all the code in an "old" controller. It happend to be "extends JControllerForm" as i need that for my real issue. libraries/phpoffice/PhpOffice/Common The size is around 8MB unpacked, 3MB packed. I'm not sure that this is the right way, but I guess they all have to be in the same folder and a deinstallation would remove everything, if it's separated into 3 different installation files. FWIW: I do not really want to hack around with composer files when I want to add something to Joomla. That's for the ones that want to build there own code base. Let me know if you want the zip file and I'll send it or upload it. PS. I can't realy find a use for Powerpont creation with PHP but it makes fun to test it. DS. |
@schnuti schnuti I am trying to use phpword in Joomla! 3.9.13 i am using Php 7.3.11 |
@teoyh Initialize in a controller
I do not remember, if I had to edit the Autoloaders. Probably I added one to the Zend path. Hope it helps. |
I manage to get it working here is what i do for those who wish to get it to work in Joomla; Download from https://github.com/PHPOffice/PHPWord/releases Once the above is complete to create a document ; I use the following code ; createSection(); $section->addText('Hello World'); $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); $objWriter->save('documents\test.docx'); ?>When i execute it i can see a the test.docx created in the folder documents |
Do you know if it's possible to update the library to a later PHPWord version with reasonable amount of time investment?
I have NO interest in using Composer even if it would be possible with Joomla. (I think it_s hard)
I_m not a professional developer or a wanna be and have no plans to hack around on that level.
I think there are limits when it comes to the autolader and I'm not sure if namespaces can be used and mixed with Joomla legacy. I'm also not sure if namespaces and file structure has a correlation.
I beliieve what I need is included in a former version of PHPWord not yet using PSR and other things so I could perhaps try to update to that version.
I have tested this version of the library with Joomla 3.5 and have come so far, that I create a document and on the fly download it without saving it to disk.
I have 7 days with 3 (might become 5) columns of lists. I want to have them in 3 (5) text columns. I could try to use 7 tables but mostly it's much harder to edit tables then plain text and thats the purpose of creating those documents - directly edit with Libre Office (Open Office) or MS Office.
I have a technically interesting part left - transform HTML text areas from the db to insert them in the PHPWord object. ;)
The text was updated successfully, but these errors were encountered: