Search in sources :

Example 1 with CTTextTabStopList

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList 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)

Example 2 with CTTextTabStopList

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

the class XSLFTextParagraph method addTabStop.

public void addTabStop(double value) {
    CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
    CTTextTabStopList tabStops = pr.isSetTabLst() ? pr.getTabLst() : pr.addNewTabLst();
    tabStops.addNewTab().setPos(Units.toEMU(value));
}
Also used : CTTextParagraphProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties) CTTextTabStopList(org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList)

Aggregations

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