@Override
public void setColumnWidth(int col, final double width){
if (col < 0 || col >= cells[0].length) {
throw new IllegalArgumentException("Column index '"+col+"' is not within range [0-"+(cells[0].length-1)+"]");
}
double currentWidth = cells[0][col].getAnchor().getWidth();
double dx = width - currentWidth;
for (HSLFTableCell cols[] : cells) {
Rectangle2D anchor = cols[col].getAnchor();
anchor.setRect(anchor.getX(), anchor.getY(), width, anchor.getHeight());
cols[col].setAnchor(anchor);
if (col < cols.length - 1) {
for (int j = col+1; j < cols.length; j++) {
anchor = cols[j].getAnchor();
anchor.setRect(anchor.getX()+dx, anchor.getY(), anchor.getWidth(), anchor.getHeight());
cols[j].setAnchor(anchor);
}
}
}
Rectangle2D tblanchor = getAnchor();
tblanchor.setRect(tblanchor.getX(), tblanchor.getY(), tblanchor.getWidth() + dx, tblanchor.getHeight());
setExteriorAnchor(tblanchor);
}