poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paoim101084 <paokimsr...@gmail.com>
Subject Re: XSLFTextRun definition
Date Tue, 18 Dec 2018 20:33:50 GMT
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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message