Example usage for org.apache.poi.xwpf.usermodel XWPFRun getCTR

List of usage examples for org.apache.poi.xwpf.usermodel XWPFRun getCTR

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel XWPFRun getCTR.

Prototype

@Internal
public CTR getCTR() 

Source Link

Document

Get the currently used CTR object

Usage

From source file:org.obeonetwork.m2doc.util.FieldUtils.java

License:Open Source License

/**
 * Returns <code>true</code> when the specified run is a field end run and <code>false</code> otherwise.
 * //from  w ww  . ja  v a  2 s . c  om
 * @param run
 *            the concerned run
 * @return <code>true</code> for field end.
 */

public boolean isFieldEnd(XWPFRun run) {
    if (run.getCTR().getFldCharList().size() > 0) {
        CTFldChar fldChar = run.getCTR().getFldCharList().get(0);
        return STFldCharType.END.equals(fldChar.getFldCharType());
    } else {
        return false;
    }
}

From source file:org.obeonetwork.m2doc.util.FieldUtils.java

License:Open Source License

/**
 * reads up the instruction of a field's run.
 * /*from   w  w w .  ja  v a 2 s.  c o m*/
 * @param run
 *            the run to read.
 * @return the aggregated instruction text of the run
 */
public static StringBuilder readUpInstrText(XWPFRun run) {
    List<CTText> texts = run.getCTR().getInstrTextList();
    StringBuilder runBuilder = new StringBuilder();
    for (CTText text : texts) {
        runBuilder.append(text.getStringValue());
    }
    return runBuilder;
}