Search code examples
javajasper-reportsindentationdynamic-reports

Aligning bullets in JasperReports


The following post answers that bullets can have a hanging indent / be aligned by adding left-padding.

Jasper Report HTML bullet hanging indent

However, when I tried to do that, the whole line would move and so the bullets would no longer be padded

So the text:

- TEXT TEXT TEXT
TEXT TEXT TEXT

would become:

    - TEXT TEXT TEXT
    TEXT TEXT TEXT

when what I want is:

- TEXT TEXT TEXT
  TEXT TEXT TEXT

How can I line up the second line of the bullets. Is there a hanging indent/first line indent that accepts negative numbers, or any other method that I could do this?


Solution

  • After playing around a bit I found that what I could do was add padding to the whole paragraph and make the first line a negative indent.

    I am using an api called dynamic reports so the way I did it was

    TextColumnBuilder<String> itemBulletsCol = col.column(
        "", COLUMN_NAME_BULLET_LIST, type.stringType()
    ).setStyle(....
            .setFirstLineIndent(-10)
            .setPadding(10)
    );