Creating a new document
Once the javadocx installation is completed, you can work with the library. To begin with, we are going to generate a document from scratch, that is, without external templates.
To do this, you'll create an example as simple as possible in which you'll add a text line and then, save the document with a name of your choice.
Whether it is necessary to create a single document or hundreds of thousands, javadocx simply is the perfect tool.
The full code for creating a document is the following:
First, import CreateDocx:
Then, in your class, create a new document:
You are going to add text, so add a string variable:
... and then add it to the document with the method addText:
To, finally generate the document:
With the file name tutorial_2.docx
When generating the document with the createDocx method, you can specify a relative or absolute path, to indicate the name and path where the file is going to be saved.
saves the document in the execution directory.
generates the document in the sub-directory files, located one level above the current directory; or
saves it in the path /var/javadocx/files.
Before setting a path for saving your files, it is necessary to check that the execution user has the required read and write access rights.
With each package of javadocx, full documentation comes in javadocx file format, which is the main reference to know in depth the software library. All public methods include a description of each of the available parameters.
In addition, it is advisable to visit:
Brief introductory tutorial to javadocx
List of public API methods with examples
For further information and to solve doubts about the use of the library, there are several resources, both internal and external:
Contact form, for direct communication with the javadocx team
Reference forum for developers