ireport報表二

/**
 * 報表基礎數據的接口
 * 
 */
public interface IReportBaseService {
	
	/**
	 * 公用方法 每個報表都不同
	 * 
	 * @param field
	 * 
	 * @return
	 * 
	 * @throws JRException
	 */
	public  Object getFieldValue(JRField field) throws JRException ;
	
	
	/**
	 * 自定義方法 返回 Object[][]
	 * @param 
	 * 		自定義參數
	 * @return
	 */
	public Object[][] getReportBaseDataService(String xx);
	

}

import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;

public class ReportBaseService implements JRDataSource , IReportBaseService{
	
	public int index = -1;
	
	private  Object[][] data ={};
	
	public Object[][] getData() {
		return data;
	}

	public void setData(Object[][] data) {
		this.data = data;
	}

	public boolean next() throws JRException {
		index++;
		return (index < data.length);
	}
	
	@Override
	public Object getFieldValue(JRField field) throws JRException {
		// TODO Auto-generated method stub
		return this.data;
	}

	@Override
	public Object[][] getReportBaseDataService(String xx) {
		// TODO Auto-generated method stub
		return null;
	}
}

發佈了39 篇原創文章 · 獲贊 2 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章