Interface ReportTemplate<T>
- Type Parameters:
T- 資料型別
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
把應用資料轉成報表文件
實作應無副作用、可重複呼叫。大型明細不要在 create 內查詢;改以 RowSource.lazy 延遲到 render 時才取得資料。
class SalesReport implements ReportTemplate<SalesReportData> {
public ReportDocument create(SalesReportData data, ReportContext ctx) {
return ReportDocument.builder()
.metadata(m -> m.title("銷售明細").language(ctx.locale()).createdAt(ctx.clock().instant()))
.heading(1, "銷售明細")
.build();
}
}
- Since:
- 4.0.0
-
Method Summary
-
Method Details
-
create
建立報表文件- Parameters:
data- 應用資料context- 產生環境- Returns:
- 文件
-