EspressReport 6.6

quadbase.reportdesigner.util
Interface ICellScript

All Superinterfaces:
java.io.Serializable

public interface ICellScript
extends java.io.Serializable

Extend this class to create a new cell script for a report, then add an instance of your class to a particular cell of your report table to apply the script. For example, write a class called myScript:

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);


Method Summary
 ReportCell formatCell(int rowIndex, ReportCell cell, java.lang.Object originalData, IFormat dataFormat)
          Format the cell according to the specified parameters
 

Method Detail

formatCell

ReportCell formatCell(int rowIndex,
                      ReportCell cell,
                      java.lang.Object originalData,
                      IFormat dataFormat)
                      throws java.lang.Exception
Format the cell according to the specified parameters

Parameters:
rowIndex - the row index of the cell
cell - the report cell itself, modify the format of this based on some criteria
originalData - original data in contained in the cell
dataFormat - the format of the data in the cell
Returns:
the modified cell that will be included in the report
Throws:
java.lang.Exception

EspressReport 6.6