Example #1
0
 /** @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;
 }
Example #2
0
  /**
   * Specifies that a shape should be auto-fit to fully contain the text described within it.
   * Auto-fitting is when text within a shape is scaled in order to contain all the text inside
   *
   * @param value type of autofit
   */
  public void setTextAutofit(TextAutofit value) {
    CTTextBodyProperties bodyPr = getTextBodyPr();
    if (bodyPr != null) {
      if (bodyPr.isSetSpAutoFit()) bodyPr.unsetSpAutoFit();
      if (bodyPr.isSetNoAutofit()) bodyPr.unsetNoAutofit();
      if (bodyPr.isSetNormAutofit()) bodyPr.unsetNormAutofit();

      switch (value) {
        case NONE:
          bodyPr.addNewNoAutofit();
          break;
        case NORMAL:
          bodyPr.addNewNormAutofit();
          break;
        case SHAPE:
          bodyPr.addNewSpAutoFit();
          break;
      }
    }
  }