本文整理了Java中org.apache.poi.xslf.usermodel.XSLFTextShape.getTextHeight()
方法的一些代码示例,展示了XSLFTextShape.getTextHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSLFTextShape.getTextHeight()
方法的具体详情如下:
包路径:org.apache.poi.xslf.usermodel.XSLFTextShape
类名称:XSLFTextShape
方法名:getTextHeight
[英]Compute the cumulative height occupied by the text
[中]计算文本占用的累积高度
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public double getTextHeight() {
return getTextHeight(null);
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public Rectangle2D resizeToFitText(Graphics2D graphics) {
Rectangle2D anchor = getAnchor();
if (anchor.getWidth() == 0.) {
throw new POIXMLException("Anchor of the shape was not set.");
}
double height = getTextHeight(graphics);
height += 1; // add a pixel to compensate rounding errors
Insets2D insets = getInsets();
anchor.setRect(anchor.getX(), anchor.getY(), anchor.getWidth(), height + insets.top + insets.bottom);
setAnchor(anchor);
return anchor;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public double getTextHeight() {
return getTextHeight(null);
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Adjust the size of the shape so it encompasses the text inside it.
*
* @return a <code>Rectangle2D</code> that is the bounds of this shape.
*/
public Rectangle2D resizeToFitText(){
Rectangle2D anchor = getAnchor();
if(anchor.getWidth() == 0.) throw new POIXMLException(
"Anchor of the shape was not set.");
double height = getTextHeight();
height += 1; // add a pixel to compensate rounding errors
anchor.setRect(anchor.getX(), anchor.getY(), anchor.getWidth(), height);
setAnchor(anchor);
return anchor;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public Rectangle2D resizeToFitText(Graphics2D graphics) {
Rectangle2D anchor = getAnchor();
if (anchor.getWidth() == 0.) {
throw new POIXMLException("Anchor of the shape was not set.");
}
double height = getTextHeight(graphics);
height += 1; // add a pixel to compensate rounding errors
Insets2D insets = getInsets();
anchor.setRect(anchor.getX(), anchor.getY(), anchor.getWidth(), height + insets.top + insets.bottom);
setAnchor(anchor);
return anchor;
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
@Override
public void drawContent(Graphics2D graphics) {
breakText(graphics);
RenderableShape rShape = new RenderableShape(this);
Rectangle2D anchor = rShape.getAnchor(graphics);
double x = anchor.getX() + getLeftInset();
double y = anchor.getY();
// first dry-run to calculate the total height of the text
double textHeight = getTextHeight();
switch (getVerticalAlignment()){
case TOP:
y += getTopInset();
break;
case BOTTOM:
y += anchor.getHeight() - textHeight - getBottomInset();
break;
default:
case MIDDLE:
double delta = anchor.getHeight() - textHeight -
getTopInset() - getBottomInset();
y += getTopInset() + delta/2;
break;
}
drawParagraphs(graphics, x, y);
}
内容来源于网络,如有侵权,请联系作者删除!