You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Poiji should look at the second (zero-based index) sheet of your excel file.
204
204
== Documentation
205
205
206
+
=== Java Records Support
207
+
208
+
Starting with version 4.9.0, Poiji supports Java Records (Java 16+). Records provide a concise way to declare data carrier classes with immutable fields.
209
+
210
+
[source,java]
211
+
----
212
+
public record EmployeeRecord(
213
+
@ExcelCellName("ID")
214
+
long employeeId,
215
+
216
+
@ExcelCellName("NAME")
217
+
String name,
218
+
219
+
@ExcelCellName("SURNAME")
220
+
String surname,
221
+
222
+
@ExcelCellName("AGE")
223
+
int age,
224
+
225
+
@ExcelCellName("SINGLE")
226
+
boolean single,
227
+
228
+
@ExcelRow
229
+
int row
230
+
) {}
231
+
----
232
+
233
+
Use records just like regular classes with Poiji:
234
+
235
+
[source,java]
236
+
----
237
+
List<EmployeeRecord> employees = Poiji.fromExcel(
238
+
new File("employees.xlsx"),
239
+
EmployeeRecord.class
240
+
);
241
+
242
+
EmployeeRecord firstEmployee = employees.get(0);
243
+
// Access fields using record accessor methods
244
+
System.out.println(firstEmployee.name());
245
+
System.out.println(firstEmployee.age());
246
+
----
247
+
248
+
Records work with all annotations including:
249
+
250
+
* `@ExcelCell` - Map by column index
251
+
* `@ExcelCellName` - Map by column name
252
+
* `@ExcelRow` - Capture row number
253
+
* `@ExcelUnknownCells` - Capture unmapped cells
254
+
255
+
Records work with both XLS and XLSX formats and support all standard Poiji options.
256
+
206
257
=== Prefer Default Value
207
258
208
259
If you want a date field to return `null` rather than a default date, use `PoijiOptionsBuilder` with the `preferNullOverDefault` method as follows:
0 commit comments