gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-22 06:59:05 54 4
gpt4 key购买 nike

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

XSLFTextRun.getRPr介绍

[英]Return the character properties
[中]返回角色属性

代码示例

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

/**
 *  Set the baseline for both the superscript and subscript fonts.
 *  <p>
 *     The size is specified using a percentage.
 *     Positive values indicate superscript, negative values indicate subscript.
 *  </p>
 */
@SuppressWarnings("WeakerAccess")
public void setBaselineOffset(double baselineOffset){
  getRPr(true).setBaseline((int) baselineOffset * 1000);
}

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

@Override
public void setBold(boolean bold){
  getRPr(true).setB(bold);
}

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

@Override
public void setItalic(boolean italic){
  getRPr(true).setI(italic);
}

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

@Override
public void setUnderlined(boolean underline) {
  getRPr(true).setU(underline ? STTextUnderlineType.SNG : STTextUnderlineType.NONE);
}

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

@Override
public void setStrikethrough(boolean strike) {
  getRPr(true).setStrike(strike ? STTextStrikeType.SNG_STRIKE : STTextStrikeType.NO_STRIKE);
}

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

@Override
public void setFontSize(Double fontSize){
  CTTextCharacterProperties rPr = getRPr(true);
  if(fontSize == null) {
    if (rPr.isSetSz()) {
      rPr.unsetSz();
    }
  } else {
    if (fontSize < 1.0) {
      throw new IllegalArgumentException("Minimum font size is 1pt but was " + fontSize);
    }
    rPr.setSz((int)(100*fontSize));
  }
}

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

private CTTextFont getXmlObject(boolean create) {
  if (create) {
    return getCTTextFont(getRPr(true), true);
  }
  CharacterPropertyFetcher<CTTextFont> visitor = new CharacterPropertyFetcher<CTTextFont>(_p.getIndentLevel()){
    @Override
    public boolean fetch(CTTextCharacterProperties props){
      CTTextFont font = getCTTextFont(props, false);
      if (font == null) {
        return false;
      }
      setValue(font);
      return true;
    }
  };
  fetchCharacterProperty(visitor);
  return  visitor.getValue();
}

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

/**
 * Set the spacing between characters within a text run.
 * <p>
 * The spacing is specified in points. Positive values will cause the text to expand,
 * negative values to condense.
 * </p>
 *
 * @param spc  character spacing in points.
 */
@SuppressWarnings("WeakerAccess")
public void setCharacterSpacing(double spc){
  CTTextCharacterProperties rPr = getRPr(true);
  if(spc == 0.0) {
    if(rPr.isSetSpc()) {
      rPr.unsetSpc();
    }
  } else {
    rPr.setSpc((int)(100*spc));
  }
}

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

@Override
public XSLFHyperlink getHyperlink(){
  CTTextCharacterProperties rPr = getRPr(false);
  if (rPr == null) {
    return null;
  }
  CTHyperlink hl = rPr.getHlinkClick();
  if (hl == null) {
    return null;
  }
  return new XSLFHyperlink(hl, _p.getParentShape().getSheet());
}

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

@Override
public XSLFHyperlink createHyperlink(){
  XSLFHyperlink hl = getHyperlink();
  if (hl != null) {
    return hl;
  }
  CTTextCharacterProperties rPr = getRPr(true);
  return new XSLFHyperlink(rPr.addNewHlinkClick(), _p.getParentShape().getSheet());
}

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

/**
 * Insert a line break
 *
 * @return text run representing this line break ('\n')
 */
@SuppressWarnings("WeakerAccess")
public XSLFTextRun addLineBreak(){
  XSLFLineBreak run = new XSLFLineBreak(_p.addNewBr(), this);
  CTTextCharacterProperties brProps = run.getRPr(true);
  if(_runs.size() > 0){
    // by default line break has the font size of the last text run
    CTTextCharacterProperties prevRun = _runs.get(_runs.size() - 1).getRPr(true);
    brProps.set(prevRun);
    // don't copy hlink properties
    if (brProps.isSetHlinkClick()) {
      brProps.unsetHlinkClick();
    }
    if (brProps.isSetHlinkMouseOver()) {
      brProps.unsetHlinkMouseOver();
    }
  }
  _runs.add(run);
  return run;
}

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

private void fetchCharacterProperty(final CharacterPropertyFetcher<?> visitor){
  XSLFTextShape shape = _p.getParentShape();
  CTTextCharacterProperties rPr = getRPr(false);
  if (rPr != null && visitor.fetch(rPr)) {
    return;
  }
  if (shape.fetchShapeProperty(visitor)) {
    return;
  }
  if (_p.fetchThemeProperty(visitor)) {
    return;
  }
  _p.fetchMasterProperty(visitor);
}

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

if (!runs.isEmpty()) {
  XSLFTextRun r0 = runs.get(runs.size() - 1);
  otherRPr = r0.getRPr(false);
  if (otherRPr == null) {
    otherRPr = ctp.getEndParaRPr();
  run.setText(runText);
  if (otherRPr != null) {
    run.getRPr(true).set(otherRPr);

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

/**
 * Helper method for appending text and keeping paragraph and character properties.
 * The character properties are moved to the end paragraph marker
 */
/* package */ void clearButKeepProperties() {
  CTTextParagraph thisP = getXmlObject();
  for (int i=thisP.sizeOfBrArray(); i>0; i--) {
    thisP.removeBr(i-1);
  }
  for (int i=thisP.sizeOfFldArray(); i>0; i--) {
    thisP.removeFld(i-1);
  }
  if (!_runs.isEmpty()) {
    int size = _runs.size();
    XSLFTextRun lastRun = _runs.get(size-1);
    CTTextCharacterProperties cpOther = lastRun.getRPr(false);
    if (cpOther != null) {
      if (thisP.isSetEndParaRPr()) {
        thisP.unsetEndParaRPr();
      }
      CTTextCharacterProperties cp = thisP.addNewEndParaRPr();
      cp.set(cpOther);
    }
    for (int i=size; i>0; i--) {
      thisP.removeR(i-1);
    }
    _runs.clear();
  }
}

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

@Override
public void setFontColor(PaintStyle color) {
  if (!(color instanceof SolidPaint)) {
    LOG.log(POILogger.WARN, "Currently only SolidPaint is supported!");
    return;
  }
  SolidPaint sp = (SolidPaint)color;
  Color c = DrawPaint.applyColorTransform(sp.getSolidColor());
  CTTextCharacterProperties rPr = getRPr(true);
  CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill();
  XSLFColor col = new XSLFColor(fill, getParentParagraph().getParentShape().getSheet().getTheme(), fill.getSchemeClr());
  col.setColor(c);
}

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

CTTextCharacterProperties props = getRPr(false);
if (props == null) {
  return;

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

/**
 * @param italic whether this run of text is formatted as italic text
 */
public void setItalic(boolean italic){
  getRPr().setI(italic);
}

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

/**
 * Specifies whether a run of text will be formatted as strikethrough text.
 *
 * @param strike whether a run of text will be formatted as strikethrough text.
 */
public void setStrikethrough(boolean strike) {
  getRPr().setStrike(strike ? STTextStrikeType.SNG_STRIKE : STTextStrikeType.NO_STRIKE);
}

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

/**
 *  Set the baseline for both the superscript and subscript fonts.
 *  <p>
 *     The size is specified using a percentage.
 *     Positive values indicate superscript, negative values indicate subscript.
 *  </p>
 */
@SuppressWarnings("WeakerAccess")
public void setBaselineOffset(double baselineOffset){
  getRPr(true).setBaseline((int) baselineOffset * 1000);
}

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

@Override
public XSLFHyperlink getHyperlink(){
  CTTextCharacterProperties rPr = getRPr(false);
  if (rPr == null) {
    return null;
  }
  CTHyperlink hl = rPr.getHlinkClick();
  if (hl == null) {
    return null;
  }
  return new XSLFHyperlink(hl, _p.getParentShape().getSheet());
}

54 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com