mnish mnish - 1 year ago 63
Java Question

table cell font in RTF with lowagie Document

I am trying to create

document with tables with empty cells.

I use the
package in java.

of the empty cells are all
Times New Roman
size 12.

How can I set the font of the empty cells to a different

I have used
RtfCell cellSpacer = new RtfCell(new Phrase("", new RtfFont("Arial", 9, RtfFont.NORMAL)));
but because the string
is empty the font doesn't take effect. When the
is filled with something except a
the font does take effect.

Thank you.

Answer Source

A solution to this problem is that the space must be given as a Non Breaking space to the Phrase constructor!

String nbs = "\u00A0";

RtfCell cellSpacer = new RtfCell(new Phrase(nbs, new RtfFont("Arial", 9, RtfFont.NORMAL)));

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download