Report Generator
| .claude | 6 months ago | ||
| src | 6 months ago | ||
| .gitignore | 1 year ago | ||
| Jenkinsfile | 2 years ago | ||
| README.md | 6 months ago | ||
| lombok.config | 5 years ago | ||
| pom.xml | 5 months ago | ||
Annotate member variables or methods that will appear on the report
@Reportable(headerName = "Name", column = "A")
@ReportableMap Map<String, Object> map
The map's key will be the headerName
Note: The map field must use a LinkedHashMap (or another ordered Map implementation) to guarantee deterministic column ordering. Using a HashMap will produce non-deterministic column order in the generated report.
Annotate reportable member variables or methods with formatters (optional)
@DateFormatter(format = "yyyy-MM-dd") @NumberFormatter(format = "#,##0.00") @StringFormatFormatter(text = "Add %s text") @StringFormatter(format = Format.UPPERCASE) @CurrencyFormatter(format = Currency.USD) @BooleanFormatter(falseText = "Not Valid", trueText = "Valid") @NullFormatter(replacementText = "No Data") @CommaFormatter @TrimFormatter
Instantiate and generate
new CSVGenerator(List<?> data, char delimiter).generate(); // returns CSV String new ExcelGenerator(List<?> data).generate(); // returns POI Workbook
Passing an empty list produces an empty report — no data rows are written. CSV and Excel output will contain headers only.
@AutoSize @Reportable(headerName = "Name", column = "A")
AutoSize coupled with Reportable will set the Excel columns to auto-adjust with column width to fit content
@DateFormatter(format = "yyyy-MM-dd")
Data types supported
Format used by java.text.SimpleDateFormat
@NumberFormatter(format = "#,##0.00")
Data types supported
Format used by java.text.DecimalFormat
@StringFormatFormatter(text = "Add %s text")
Data types supported
@StringFormatter(format = Format.UPPERCASE)
Data types supported
Options
@CurrencyFormatter(format = Currency.USD)
Data types supported
Options
@BooleanFormatter(falseText = "Not Valid", trueText = "Valid")
Arguments
@NullFormatter(replacementText = "No Data")
Data ytpes supported
Arguments
@CommaFormatter
Data types supported
@TrimFormatter
Data types supported
@Hyperlink
Creates a hyperlink out of the cell data
Note: Only applies to ExcelGenerator