Add method for setting bullet styles

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1711707 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-10-31 23:10:43 +00:00
parent f91f9120c2
commit 785b37342e
2 changed files with 31 additions and 0 deletions

View File

@ -332,6 +332,15 @@ public interface TextParagraph<
* @return the bullet style of the paragraph, if {@code null} then no bullets are used
*/
BulletStyle getBulletStyle();
/**
* Sets the bullet styles. If no styles are given, the bullets are omitted.
* Possible attributes are integer/double (bullet size), Color (bullet color),
* character (bullet character), string (bullet font), AutoNumberingScheme
*
* @param styles
*/
void setBulletStyle(Object... styles);
/**
* @return the default size for a tab character within this paragraph in points, null if unset

View File

@ -985,4 +985,26 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
};
}
@Override
public void setBulletStyle(Object... styles) {
if (styles.length == 0) {
setBullet(false);
} else {
setBullet(true);
for (Object ostyle : styles) {
if (ostyle instanceof Number) {
setBulletFontSize(((Number)ostyle).doubleValue());
} else if (ostyle instanceof Color) {
setBulletFontColor((Color)ostyle);
} else if (ostyle instanceof Character) {
setBulletCharacter(ostyle.toString());
} else if (ostyle instanceof String) {
setBulletFont((String)ostyle);
} else if (ostyle instanceof AutoNumberingScheme) {
setBulletAutoNumber((AutoNumberingScheme)ostyle, 0);
}
}
}
}
}