Search in sources :

Example 6 with ParagraphPropertyFetcher

use of org.apache.poi.xslf.model.ParagraphPropertyFetcher in project poi by apache.

the class XSLFTextParagraph method getSpaceBefore.

@Override
public Double getSpaceBefore() {
    ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()) {

        public boolean fetch(CTTextParagraphProperties props) {
            if (props.isSetSpcBef()) {
                CTTextSpacing spc = props.getSpcBef();
                if (spc.isSetSpcPct())
                    setValue(spc.getSpcPct().getVal() * 0.001);
                else if (spc.isSetSpcPts())
                    setValue(-spc.getSpcPts().getVal() * 0.01);
                return true;
            }
            return false;
        }
    };
    fetchParagraphProperty(fetcher);
    return fetcher.getValue();
}
Also used : ParagraphPropertyFetcher(org.apache.poi.xslf.model.ParagraphPropertyFetcher) CTTextSpacing(org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing) CTTextParagraphProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties)

Aggregations

ParagraphPropertyFetcher (org.apache.poi.xslf.model.ParagraphPropertyFetcher)6 CTTextParagraphProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties)6 CTTextSpacing (org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing)3 Color (java.awt.Color)1 AutoNumberingScheme (org.apache.poi.sl.usermodel.AutoNumberingScheme)1 CTColor (org.openxmlformats.schemas.drawingml.x2006.main.CTColor)1 CTSRgbColor (org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor)1 CTTextNormalAutofit (org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit)1 CTTextTabStop (org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStop)1 CTTextTabStopList (org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList)1