return theCell;
}
public Cell toPDF() {
Cell aCell = new Cell();
String aFontName = FontFactory.HELVETICA;//TODO make configurable
int aFontSize = 12;
int aFontFace = Font.NORMAL;
// align
if (itsAlign == ALIGN_LEFT || itsAlign == ALIGN_NONE ) {
aCell.setHorizontalAlignment(Element.ALIGN_LEFT);
} else if (itsAlign == ALIGN_CENTER) {
aCell.setHorizontalAlignment(Element.ALIGN_CENTER);
} else if (itsAlign == ALIGN_RIGHT) {
aCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
} else {
//TODO warning?
}
if (isHeader) {
//todo set bottom line
aFontFace = Font.BOLD;
}
if (itsBold) {
if (itsItalic) {
aFontFace = Font.BOLDITALIC;
} else {
aFontFace = Font.BOLD;
}
} else if (itsItalic) {
aFontFace = Font.ITALIC;
} else if (itsUnderline) {
aFontFace = Font.UNDERLINE;
} else if (itsStrikethru) {
aFontFace = Font.STRIKETHRU;
}
//TODO black and white option?
Chunk aChunk = null;
if (itsURL != null && itsURLinPDF) {
try {
aChunk = new Chunk(itsValue, FontFactory.getFont(aFontName, aFontSize, Font.UNDERLINE, getColor("blue")));
aChunk.setAnchor(new URL("http://www.lowagie.com/iText/"));
} catch (MalformedURLException e) {
//TODO
}
} else {
if (itsForegroundColor != null) {
aChunk = new Chunk(itsValue, FontFactory.getFont(aFontName, aFontSize, aFontFace, getColor(itsForegroundColor)));
} else {
aChunk = new Chunk(itsValue, FontFactory.getFont(aFontName, aFontSize, aFontFace));
}
}
if (itsBackgroundColor != null) {
//TODO
}
aCell.add(aChunk);
return aCell;
}