public interface ICellScript
extends java.io.Serializable
public class myScript implements ICellScript {
// makes the font color of the cell RED if the data is less than 0
public ReportCell formatCell(int rowIndex, ReportCell cell, Object originalData,
IFormat dataFormat) throws Exception
{
if (originalData instanceof Double)
if (((Double)originalData).intValue() < 0)
cell.setFontColor(java.awt.Color.red);
return cell;
}
}
create an instance of your cell script object and apply it to a cell like so:
ICellScript script = new myScript();
report.getTable().getColumn(1).setCellScript(script);
Modifier and Type | Method and Description |
---|---|
ReportCell |
formatCell(int rowIndex,
ReportCell cell,
java.lang.Object originalData,
IFormat dataFormat)
Format the cell according to the specified parameters
|
ReportCell formatCell(int rowIndex, ReportCell cell, java.lang.Object originalData, IFormat dataFormat) throws java.lang.Exception
rowIndex
- the row index of the cellcell
- the report cell itself, modify the format of this based on some criteriaoriginalData
- original data in contained in the celldataFormat
- the format of the data in the celljava.lang.Exception