/** * Set this paragraph as an automatic numbered bullet point * * @param scheme type of auto-numbering */ public void setBullet(ListAutoNumber scheme) { CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextAutonumberBullet lst = pr.isSetBuAutoNum() ? pr.getBuAutoNum() : pr.addNewBuAutoNum(); lst.setType(STTextAutonumberScheme.Enum.forInt(scheme.ordinal() + 1)); if(!pr.isSetBuFont()) pr.addNewBuFont().setTypeface("Arial"); if(pr.isSetBuNone()) pr.unsetBuNone(); // remove these elements if present as it results in invalid content when opening in Excel. if(pr.isSetBuBlip()) pr.unsetBuBlip(); if(pr.isSetBuChar()) pr.unsetBuChar(); }
/** * Set or unset this paragraph as a bullet point * * @param flag whether text in this paragraph has bullets */ public void setBullet(boolean flag) { if(isBullet() == flag) return; CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); if(!flag) { pr.addNewBuNone(); if(pr.isSetBuAutoNum()) pr.unsetBuAutoNum(); if(pr.isSetBuBlip()) pr.unsetBuBlip(); if(pr.isSetBuChar()) pr.unsetBuChar(); if(pr.isSetBuClr()) pr.unsetBuClr(); if(pr.isSetBuClrTx()) pr.unsetBuClrTx(); if(pr.isSetBuFont()) pr.unsetBuFont(); if(pr.isSetBuFontTx()) pr.unsetBuFontTx(); if(pr.isSetBuSzPct()) pr.unsetBuSzPct(); if(pr.isSetBuSzPts()) pr.unsetBuSzPts(); if(pr.isSetBuSzTx()) pr.unsetBuSzTx(); } else { if(pr.isSetBuNone()) pr.unsetBuNone(); if(!pr.isSetBuFont()) pr.addNewBuFont().setTypeface("Arial"); if(!pr.isSetBuAutoNum()) pr.addNewBuChar().setChar("\u2022"); } }
/** * Set the color to be used on bullet characters within a given paragraph. * * @param color the bullet color */ public void setBulletFontColor(Color color){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTColor c = pr.isSetBuClr() ? pr.getBuClr() : pr.addNewBuClr(); CTSRgbColor clr = c.isSetSrgbClr() ? c.getSrgbClr() : c.addNewSrgbClr(); clr.setVal(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()}); }
public XDDFBulletStyle getBulletStyle() { if (props.isSetBuAutoNum()) { return new XDDFBulletStyleAutoNumbered(props.getBuAutoNum()); } else if (props.isSetBuBlip()) { return new XDDFBulletStylePicture(props.getBuBlip()); } else if (props.isSetBuChar()) { return new XDDFBulletStyleCharacter(props.getBuChar()); } else if (props.isSetBuNone()) { return new XDDFBulletStyleNone(props.getBuNone()); } else { return null; } }
/** * Sets the bullet size that is to be used within a paragraph. * This may be specified in two different ways, percentage spacing and font point spacing: * <p> * If bulletSize >= 0, then bulletSize is a percentage of the font size. * If bulletSize < 0, then it specifies the size in points * </p> */ @SuppressWarnings("WeakerAccess") public void setBulletFontSize(double bulletSize){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); if(bulletSize >= 0) { CTTextBulletSizePercent pt = pr.isSetBuSzPct() ? pr.getBuSzPct() : pr.addNewBuSzPct(); pt.setVal((int)(bulletSize*1000)); if(pr.isSetBuSzPts()) pr.unsetBuSzPts(); } else { CTTextBulletSizePoint pt = pr.isSetBuSzPts() ? pr.getBuSzPts() : pr.addNewBuSzPts(); pt.setVal((int)(-bulletSize*100)); if(pr.isSetBuSzPct()) pr.unsetBuSzPct(); } }
public void setBulletCharacter(String str){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextCharBullet c = pr.isSetBuChar() ? pr.getBuChar() : pr.addNewBuChar(); c.setChar(str); }
public void setBulletFont(String typeface){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextFont font = pr.isSetBuFont() ? pr.getBuFont() : pr.addNewBuFont(); font.setTypeface(typeface); }
public boolean fetch(CTTextParagraphProperties props){ if(props.isSetBuAutoNum() && props.getBuAutoNum().isSetStartAt()) { setValue(props.getBuAutoNum().getStartAt()); return true; } return false; } };
/** * Returns the alignment that is applied to the paragraph. * * If this attribute is omitted, then a value of left is implied. * * @return alignment that is applied to the paragraph */ public TextAlignment getTextAlignment() { return findDefinedParagraphProperty(props -> props.isSetAlgn(), props -> props.getAlgn()) .map(align -> TextAlignment.valueOf(align)).orElse(null); }
/** * Specifies that automatic numbered bullet points should be applied to this paragraph * * @param scheme type of auto-numbering * @param startAt the number that will start number for a given sequence of automatically numbered bullets (1-based). */ @SuppressWarnings("WeakerAccess") public void setBulletAutoNumber(AutoNumberingScheme scheme, int startAt) { if(startAt < 1) throw new IllegalArgumentException("Start Number must be greater or equal that 1") ; CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextAutonumberBullet lst = pr.isSetBuAutoNum() ? pr.getBuAutoNum() : pr.addNewBuAutoNum(); lst.setType(STTextAutonumberScheme.Enum.forInt(scheme.ooxmlId)); lst.setStartAt(startAt); }
public boolean fetch(CTTextParagraphProperties props){ if(props.isSetBuChar()){ setValue(props.getBuChar().getChar()); return true; } return false; } };
/** * * @param flag whether text in this paragraph has bullets */ public void setBullet(boolean flag) { if(isBullet() == flag) return; CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); if(!flag) { pr.addNewBuNone(); } else { pr.addNewBuFont().setTypeface("Arial"); pr.addNewBuChar().setChar("\u2022"); } }
/** * Sets the bullet size that is to be used within a paragraph. * This may be specified in two different ways, percentage spacing and font point spacing: * <p> * If bulletSize >= 0, then bulletSize is a percentage of the font size. * If bulletSize < 0, then it specifies the size in points * </p> */ public void setBulletFontSize(double bulletSize){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); if(bulletSize >= 0) { // percentage CTTextBulletSizePercent pt = pr.isSetBuSzPct() ? pr.getBuSzPct() : pr.addNewBuSzPct(); pt.setVal((int)(bulletSize*1000)); // unset points if percentage is now set if(pr.isSetBuSzPts()) pr.unsetBuSzPts(); } else { // points CTTextBulletSizePoint pt = pr.isSetBuSzPts() ? pr.getBuSzPts() : pr.addNewBuSzPts(); pt.setVal((int)(-bulletSize*100)); // unset percentage if points is now set if(pr.isSetBuSzPct()) pr.unsetBuSzPct(); } }
public XDDFBulletStyle getBulletStyle() { if (props.isSetBuAutoNum()) { return new XDDFBulletStyleAutoNumbered(props.getBuAutoNum()); } else if (props.isSetBuBlip()) { return new XDDFBulletStylePicture(props.getBuBlip()); } else if (props.isSetBuChar()) { return new XDDFBulletStyleCharacter(props.getBuChar()); } else if (props.isSetBuNone()) { return new XDDFBulletStyleNone(props.getBuNone()); } else { return null; } }
@SuppressWarnings("WeakerAccess") public void setBulletCharacter(String str){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextCharBullet c = pr.isSetBuChar() ? pr.getBuChar() : pr.addNewBuChar(); c.setChar(str); }
@SuppressWarnings("WeakerAccess") public void setBulletFont(String typeface){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextFont font = pr.isSetBuFont() ? pr.getBuFont() : pr.addNewBuFont(); font.setTypeface(typeface); }
public boolean fetch(CTTextParagraphProperties props) { if (props.isSetBuAutoNum()) { if (props.getBuAutoNum().isSetStartAt()) { setValue(props.getBuAutoNum().getStartAt()); return true; } } return false; } };
/** * Specifies that automatic numbered bullet points should be applied to this paragraph * * @param scheme type of auto-numbering * @param startAt the number that will start number for a given sequence of automatically numbered bullets (1-based). */ @SuppressWarnings("WeakerAccess") public void setBulletAutoNumber(AutoNumberingScheme scheme, int startAt) { if(startAt < 1) throw new IllegalArgumentException("Start Number must be greater or equal that 1") ; CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextAutonumberBullet lst = pr.isSetBuAutoNum() ? pr.getBuAutoNum() : pr.addNewBuAutoNum(); lst.setType(STTextAutonumberScheme.Enum.forInt(scheme.ooxmlId)); lst.setStartAt(startAt); }
public boolean fetch(CTTextParagraphProperties props){ if(props.isSetBuChar()){ setValue(props.getBuChar().getChar()); return true; } return false; } };