public class TableCellHandler implements TagHandler, Alignable {
public void start(HTMLSerializer ser, StyledElement elem) {
if (ser.isParseTables()) {
TableCell cell = ser.addCell();
if (cell != null) {
String align = elem.getAttributes().getValue("align");
int alignment = Align.LEFT;
if (align != null) {
align = align.toLowerCase();
if (align.equals("right")) {
cell.setAlignment(Align.RIGHT);
} else if (align.equals("center") || align.equals("middle")) {
cell.setAlignment(Align.CENTER);
} else if (align.equals("justify")) {
cell.setAlignment(Align.JUSTIFY);
}
}
try {
int rowspan = Integer.parseInt(elem.getAttributes().getValue("rowspan"));
cell.setRowSpan(rowspan);
}
catch (NumberFormatException e) {
}
try {
int colspan = Integer.parseInt(elem.getAttributes().getValue("colspan"));
cell.setColumnSpan(colspan);
}
catch (NumberFormatException e) {
}
}
} else {