Search in sources :

Example 1 with CTStrRef

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTStrRef in project poi by apache.

the class XSSFChart method setTitleFormula.

/**
	 * Set the formula expression to use for the chart title
	 * @param formula
	 */
public void setTitleFormula(String formula) {
    CTTitle ctTitle;
    if (chart.isSetTitle()) {
        ctTitle = chart.getTitle();
    } else {
        ctTitle = chart.addNewTitle();
    }
    CTTx tx;
    if (ctTitle.isSetTx()) {
        tx = ctTitle.getTx();
    } else {
        tx = ctTitle.addNewTx();
    }
    if (tx.isSetRich()) {
        tx.unsetRich();
    }
    CTStrRef strRef;
    if (tx.isSetStrRef()) {
        strRef = tx.getStrRef();
    } else {
        strRef = tx.addNewStrRef();
    }
    strRef.setF(formula);
}
Also used : CTStrRef(org.openxmlformats.schemas.drawingml.x2006.chart.CTStrRef) CTTx(org.openxmlformats.schemas.drawingml.x2006.chart.CTTx) CTTitle(org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle)

Example 2 with CTStrRef

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTStrRef in project ocvn by devgateway.

the class XSSFChartUtil method buildStrRef.

private static void buildStrRef(final CTStrRef ctStrRef, final ChartDataSource<?> dataSource) {
    ctStrRef.setF(dataSource.getFormulaString());
    CTStrData cache = ctStrRef.addNewStrCache();
    fillStringCache(cache, dataSource);
}
Also used : CTStrData(org.openxmlformats.schemas.drawingml.x2006.chart.CTStrData)

Aggregations

CTStrData (org.openxmlformats.schemas.drawingml.x2006.chart.CTStrData)1 CTStrRef (org.openxmlformats.schemas.drawingml.x2006.chart.CTStrRef)1 CTTitle (org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle)1 CTTx (org.openxmlformats.schemas.drawingml.x2006.chart.CTTx)1