Hi Andi,
Thank for your detail information.
Yes, I want to calculate the table height.
Could you help to provide some idea about that?
Here is what I did but it seems not work well:
static void calculateTableHeight(XSLFTable tab, Rectangle2D anchor) {//FIXME
- issue?
double totalCellAnchorHeight = 0;
for (XSLFTableRow row : tab.getRows()) {
/*for (XSLFTableCell cell : row.getCells()) {
cell.resizeToFitText(); //make Cell Height fits
with Text Height
}*/
List<Double> cellAnchorHeightList =
row.getCells().stream().map(c ->
c.getAnchor().getHeight()).collect(Collectors.toList());
double maxCellAnchorHeight =
Collections.max(cellAnchorHeightList);// Get
only Max Cell Anchor's height
totalCellAnchorHeight += maxCellAnchorHeight;
}
Rectangle2D newAnchor = new Rectangle2D.Double(anchor.getX(),
anchor.getY(), anchor.getWidth(), totalCellAnchorHeight);
tab.setAnchor(newAnchor);
}
--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]