boxable: adding line break inside a column, question about fonts and multiple rows within a cell
Given a cell, like follows: cell = row.createCell(20, "Email: " + bean.getEmail()), how can I put a line break between Email and the variable bean.getEmail()?
I know, for example, that to make the Email word bold, I could do: row.createCell(20, "<b>Email:<b> " + bean.getEmail()) but I haven’t been able to figure out how to make a line break.
Also, do I have other font options besides the one available in the class PDType1Font?
In the attached image I present an example of what I am trying to do when it comes to having multiple rows within a cell. Please see what the red arrows is pointing to. Can I accomplish that using Boxable?

About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (1 by maintainers)
Hi Erick,
I did not look into your code, but you can use
Table.getCurrentPage()to retrieve the page. Hope this already helps.Markus
Good catch, my brain auto-corrected it to a closing tag 😄
Just a quick correction with
<b>tag. If you don’t want your email adress also be bold then you need to write:because if yout don’t close your bold text in your previous line, it will be carried in your next line.
Other thing, I also think that you will need to apply @dobluth third solution. It’s not so “clean” but hopefully that solves your current problem.
Hi Erick,
to generate a line break, you can use HTML tags, too (
<br>):You can use another
PDFont, just load it, for example:I see three options to generate an output like in your image:
To fake such a table you would have to generate 3 rows (“Grupo Familiar”, “Adicionales”, “Costo Total”). In the columns “Plan seleccionado” and “Código de Plan” you draw no borders between rows 1/2 and rows 2/3. It gets harder if you have some text in those two columns, as there are still three rows, leading to the question: where do you output it? But as long as there is no text, you should be fine 😉
Markus