org.apache.poi.xslf.usermodel.XSLFTextShape.getTextBodyPr()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.apache.poi.xslf.usermodel.XSLFTextShape.getTextBodyPr()方法的一些代码示例,展示了XSLFTextShape.getTextBodyPr()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSLFTextShape.getTextBodyPr()方法的具体详情如下:
包路径:org.apache.poi.xslf.usermodel.XSLFTextShape
类名称:XSLFTextShape
方法名:getTextBodyPr

XSLFTextShape.getTextBodyPr介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

protected CTTextBodyProperties getTextBodyPr() {
  return getTextBodyPr(false);
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public void setTextRotation(Double rotation) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    bodyPr.setRot((int) (rotation * 60000.));
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public void setWordWrap(boolean wrap) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    bodyPr.setWrap(wrap ? STTextWrappingType.SQUARE : STTextWrappingType.NONE);
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public Double getTextRotation() {
  CTTextBodyProperties bodyPr = getTextBodyPr();
  if (bodyPr != null && bodyPr.isSetRot()) {
    return bodyPr.getRot() / 60000.;
  }
  return null;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public TextDirection getTextDirection() {
  CTTextBodyProperties bodyPr = getTextBodyPr();
  if (bodyPr != null) {
    STTextVerticalType.Enum val = bodyPr.getVert();
    if (val != null) {
      switch (val.intValue()) {
      default:
      case STTextVerticalType.INT_HORZ:
        return TextDirection.HORIZONTAL;
      case STTextVerticalType.INT_EA_VERT:
      case STTextVerticalType.INT_MONGOLIAN_VERT:
      case STTextVerticalType.INT_VERT:
        return TextDirection.VERTICAL;
      case STTextVerticalType.INT_VERT_270:
        return TextDirection.VERTICAL_270;
      case STTextVerticalType.INT_WORD_ART_VERT_RTL:
      case STTextVerticalType.INT_WORD_ART_VERT:
        return TextDirection.STACKED;
      }
    }
  }
  return TextDirection.HORIZONTAL;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public void setHorizontalCentered(Boolean isCentered) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    if (isCentered == null) {
      if (bodyPr.isSetAnchorCtr()) {
        bodyPr.unsetAnchorCtr();
      }
    } else {
      bodyPr.setAnchorCtr(isCentered);
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Sets the bottom margin.
 *
 * @see #getBottomInset()
 *
 * @param margin
 *            the bottom margin
 */
public void setBottomInset(double margin) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    if (margin == -1) {
      bodyPr.unsetBIns();
    } else {
      bodyPr.setBIns(Units.toEMU(margin));
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Sets the left margin.
 *
 * @see #getLeftInset()
 *
 * @param margin
 *            the left margin
 */
public void setLeftInset(double margin) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    if (margin == -1) {
      bodyPr.unsetLIns();
    } else {
      bodyPr.setLIns(Units.toEMU(margin));
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Sets the right margin.
 *
 * @see #getRightInset()
 *
 * @param margin
 *            the right margin
 */
public void setRightInset(double margin) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    if (margin == -1) {
      bodyPr.unsetRIns();
    } else {
      bodyPr.setRIns(Units.toEMU(margin));
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 *
 * @return type of autofit
 */
public TextAutofit getTextAutofit() {
  CTTextBodyProperties bodyPr = getTextBodyPr();
  if (bodyPr != null) {
    if (bodyPr.isSetNoAutofit()) {
      return TextAutofit.NONE;
    } else if (bodyPr.isSetNormAutofit()) {
      return TextAutofit.NORMAL;
    } else if (bodyPr.isSetSpAutoFit()) {
      return TextAutofit.SHAPE;
    }
  }
  return TextAutofit.NORMAL;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Sets the top margin.
 *
 * @see #getTopInset()
 *
 * @param margin
 *            the top margin
 */
public void setTopInset(double margin) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    if (margin == -1) {
      bodyPr.unsetTIns();
    } else {
      bodyPr.setTIns(Units.toEMU(margin));
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public Double getLineSpacing(){
  final Double lnSpc = getSpacing(props -> props::getLnSpc);
  if (lnSpc != null && lnSpc > 0) {
    // check if the percentage value is scaled
    final CTTextNormalAutofit normAutofit = getParentShape().getTextBodyPr().getNormAutofit();
    if (normAutofit != null) {
      final double scale = 1 - (double)normAutofit.getLnSpcReduction() / 100000;
      return lnSpc * scale;
    }
  }
  
  return lnSpc;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public void setTextDirection(TextDirection orientation) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    if (orientation == null) {
      if (bodyPr.isSetVert()) {
        bodyPr.unsetVert();
      }
    } else {
      bodyPr.setVert(STTextVerticalType.Enum.forInt(orientation.ordinal() + 1));
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public void setVerticalAlignment(VerticalAlignment anchor) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    if (anchor == null) {
      if (bodyPr.isSetAnchor()) {
        bodyPr.unsetAnchor();
      }
    } else {
      bodyPr.setAnchor(STTextAnchoringType.Enum.forInt(anchor.ordinal() + 1));
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public Double getFontSize(){
  double scale = 1;
  final XSLFTextShape ps = getParentParagraph().getParentShape();
  if (ps != null) {
    final CTTextBodyProperties tbp = ps.getTextBodyPr();
    if (tbp != null) {
      CTTextNormalAutofit afit = tbp.getNormAutofit();
      if (afit != null && afit.isSetFontScale()) {
        scale = afit.getFontScale() / 100000.;
      }
    }
  }
  final CharacterPropertyFetcher<Double> fetcher = new CharacterPropertyFetcher<Double>(_p.getIndentLevel()){
    @Override
    public boolean fetch(CTTextCharacterProperties props){
      if (props != null && props.isSetSz()) {
        setValue(props.getSz()*0.01);
        return true;
      }
      return false;
    }
  };
  fetchCharacterProperty(fetcher);
  return fetcher.getValue() == null ? null : fetcher.getValue()*scale;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

CTTextBodyProperties bodyPr = getTextBodyPr(true);
if (bodyPr != null) {
  if (bodyPr.isSetSpAutoFit()) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
public void setWordWrap(boolean wrap) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    bodyPr.setWrap(wrap ? STTextWrappingType.SQUARE : STTextWrappingType.NONE);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
public void setTextRotation(Double rotation) {
  CTTextBodyProperties bodyPr = getTextBodyPr(true);
  if (bodyPr != null) {
    bodyPr.setRot((int) (rotation * 60000.));
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 *
 * @param wrap  whether to wrap words within the bounding rectangle
 */
public void setWordWrap(boolean wrap){
  CTTextBodyProperties bodyPr = getTextBodyPr();
  if (bodyPr != null) {
    bodyPr.setWrap(wrap ? STTextWrappingType.SQUARE : STTextWrappingType.NONE);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
public Double getLineSpacing(){
  final Double lnSpc = getSpacing(props -> props::getLnSpc);
  if (lnSpc != null && lnSpc > 0) {
    // check if the percentage value is scaled
    final CTTextNormalAutofit normAutofit = getParentShape().getTextBodyPr().getNormAutofit();
    if (normAutofit != null) {
      final double scale = 1 - (double)normAutofit.getLnSpcReduction() / 100000;
      return lnSpc * scale;
    }
  }
  
  return lnSpc;
}

相关文章