B4J/B4A using Word
When i was exploring the Apache POI library (
Apache POI API docs) for use in my Report writer B4J tutorial, i created a small test project. It worked fine but the XLUtils library also contains the functionality to work with Word documents (
xlutils-creating-ms-word-documents). So i used that library instead.
With the poishadow-all.jar library for B4A it’s also possible to create Word documents as Johan has demonstrated. In this example i used my test code again. (you can find it in the attachment).
I added some code to save the document in the files folder of the app (b4a.B4Ausingword). The project name remained B4J_using_word but you can open it in the B4A IDE (the zip file contains a B4A folder with the B4A project files).
The document will also be saved in the Download folder using the MediaStore.
Once the document is saved you can tap on the Show button to open the ContentChooser. Go to the Download folder and choose the „testdocument_timeticks.docx“ file. An intent will be started to open the file with the „softmaker.applications.office.textmaker“ app. You can change that to use your specific Word document reader app.
When you start the app the first time the files folder gets created and the app will crash because the image file is not yet in that folder. Copy the image file from the files folder of the project to that files folder of the app on the device. Use an USB cable and Windows explorer to do that (set Transferring files on the device USB settings).
Start the app again and now the image should be in the document.
The source code contains B4J blocks. You can use the B4Jversion zip file to test. Change the path to the image file.
If you have the Textmaker Windows application on your PC then the exact same document can be shown.
View attachment 170905 View attachment 170906