Practical javadocx

Sections and properties


When working with javadocx, documents don't have to be strictly A4 size. javadocx provides the necessary methods to modify the page size, as well as create new sections with different properties and set the internal properties such as author, description and keywords.

New sections

The method available for adding new sections is:

With this method, you count with the following parameters:

  • sectionType: This string defines the type of section like nextPage, nextColumn or continuous.
  • paperType: The paper size: A4, A3, letter-landscape, etc.
  • options: Additional options such as width, height, number of columns, margin and orientation.

For example, you can create a section in a new document. After creating the document with a text, write this code:

Then, add the new section:

Now, add the new contents to that new section:

You can create as much sections with its attributes as you wish.

Document properties

Each document has internal properties such as subject, creator, description or categories. Besides, it counts with full-customizable properties in its name and value.

javadocx provides addProperties to define the properties:

options is an object with the properties to add. Besides its predefined properties like subject or creator, the custom key allows to add new properties.

For example, for inserting multiple properties in the document, use the code:

Setting the document layout

To modify the paper size without creating a new section, call modifyPageLayout:

The values of both parameters are similar to the ones of the addSection method.

For example, to define an A3-landscape page size with three columns, write this code:

Tips and tricks

Right to left: javadocx is also fully compatible to use right-to-left languages.
Check the Right to left languages tutorial on our documentation.

Next - Styles