예제 #1
0
  @Override
  void copy(XSLFShape other) {
    super.copy(other);

    XSLFTextShape otherTS = (XSLFTextShape) other;
    CTTextBody otherTB = otherTS.getTextBody(false);
    CTTextBody thisTB = getTextBody(true);
    if (otherTB == null) {
      return;
    }

    thisTB.setBodyPr((CTTextBodyProperties) otherTB.getBodyPr().copy());

    if (thisTB.isSetLstStyle()) thisTB.unsetLstStyle();
    if (otherTB.isSetLstStyle()) {
      thisTB.setLstStyle((CTTextListStyle) otherTB.getLstStyle().copy());
    }

    boolean srcWordWrap = otherTS.getWordWrap();
    if (srcWordWrap != getWordWrap()) {
      setWordWrap(srcWordWrap);
    }

    double leftInset = otherTS.getLeftInset();
    if (leftInset != getLeftInset()) {
      setLeftInset(leftInset);
    }
    double rightInset = otherTS.getRightInset();
    if (rightInset != getRightInset()) {
      setRightInset(rightInset);
    }
    double topInset = otherTS.getTopInset();
    if (topInset != getTopInset()) {
      setTopInset(topInset);
    }
    double bottomInset = otherTS.getBottomInset();
    if (bottomInset != getBottomInset()) {
      setBottomInset(bottomInset);
    }

    VerticalAlignment vAlign = otherTS.getVerticalAlignment();
    if (vAlign != getVerticalAlignment()) {
      setVerticalAlignment(vAlign);
    }

    clearText();

    for (XSLFTextParagraph srcP : otherTS.getTextParagraphs()) {
      XSLFTextParagraph tgtP = addNewTextParagraph();
      tgtP.copy(srcP);
    }
  }
예제 #2
0
  public void setText(String text) {
    clearText();

    addNewTextParagraph().addNewTextRun().setText(text);
  }