addLine(line); // add empty line - all cells need some lines even if they are empty
line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
}
else {
for (Iterator j = chunks.iterator(); j.hasNext();) {
Chunk c = (Chunk) j.next();
chunk = new PdfChunk(c, (PdfAction) (allActions.get(aCounter++)));
while ((overflow = line.add(chunk)) != null) {
addLine(line);
line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
chunk = overflow;
}
}
}
// if the element is a paragraph, section or chapter, we reset the alignment and add the line
switch (element.type()) {
case Element.PARAGRAPH:
case Element.SECTION:
case Element.CHAPTER:
line.resetAlignment();
flushCurrentLine();
}
}
}
flushCurrentLine();
if (lines.size() > cell.getMaxLines()) {
while (lines.size() > cell.getMaxLines()) {
removeLine(lines.size() - 1);
}
if (cell.getMaxLines() > 0) {
String more = cell.getShowTruncation();
if (more != null && more.length() > 0) {
// Denote that the content has been truncated
lastLine = (PdfLine) lines.get(lines.size() - 1);
if (lastLine.size() >= 0) {
PdfChunk lastChunk = lastLine.getChunk(lastLine.size() - 1);
float moreWidth = new PdfChunk(more, lastChunk).width();
while (lastChunk.toString().length() > 0 && lastChunk.width() + moreWidth > right - left) {
// Remove characters to leave room for the 'more' indicator
lastChunk.setValue(lastChunk.toString().substring(0, lastChunk.length() - 1));
}
lastChunk.setValue(lastChunk.toString() + more);
} else {
lastLine.add(new PdfChunk(new Chunk(more), null));
}
}
}
}
// we set some additional parameters