Search in sources :

Example 1 with CTTextTabStop

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStop in project poi by apache.

the class XSLFTextParagraph method getTabStop.

public double getTabStop(final int idx) {
    ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()) {

        public boolean fetch(CTTextParagraphProperties props) {
            if (props.isSetTabLst()) {
                CTTextTabStopList tabStops = props.getTabLst();
                if (idx < tabStops.sizeOfTabArray()) {
                    CTTextTabStop ts = tabStops.getTabArray(idx);
                    double val = Units.toPoints(ts.getPos());
                    setValue(val);
                    return true;
                }
            }
            return false;
        }
    };
    fetchParagraphProperty(fetcher);
    return fetcher.getValue() == null ? 0. : fetcher.getValue();
}
Also used : ParagraphPropertyFetcher(org.apache.poi.xslf.model.ParagraphPropertyFetcher) CTTextTabStop(org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStop) CTTextParagraphProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties) CTTextTabStopList(org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList)

Aggregations

ParagraphPropertyFetcher (org.apache.poi.xslf.model.ParagraphPropertyFetcher)1 CTTextParagraphProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties)1 CTTextTabStop (org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStop)1 CTTextTabStopList (org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList)1