Example usage for org.apache.poi.ss.formula.ptg StringPtg getValue

List of usage examples for org.apache.poi.ss.formula.ptg StringPtg getValue

Introduction

In this page you can find the example usage for org.apache.poi.ss.formula.ptg StringPtg getValue.

Prototype

public String getValue() 

Source Link

Usage

From source file:org.sysmodb.PatchedPoi.java

License:BSD License

protected String getStringFromPtgTokens(Ptg[] tokens, HSSFWorkbook hssfWorkbook) {

    StringBuilder sb = new StringBuilder();
    for (Ptg token : tokens) {
        if (token instanceof NamePtg) {
            NamePtg namePtg = (NamePtg) token;
            HSSFEvaluationWorkbook wb = HSSFEvaluationWorkbook.create(hssfWorkbook);
            sb.append(wb.getNameText(namePtg));
        } else if (token instanceof StringPtg) {
            StringPtg stringPtg = (StringPtg) token;
            sb.append(stringPtg.getValue());
        } else if (token instanceof IntPtg) {
            IntPtg intPtg = (IntPtg) token;
            sb.append(intPtg.getValue());
        }/*from   w w  w  . ja  va  2 s  .c  o  m*/
    }
    return sb.toString();
}