Skip to content

Commit

Permalink
doc: add ExcelCellName expression explanation
Browse files Browse the repository at this point in the history
Is absent

Refs #304
  • Loading branch information
aerfus committed Feb 27, 2024
1 parent 50fb41a commit 1c88723
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -271,24 +271,31 @@ public class Person {
@ExcelCellName("Email")
protected String email;
@ExcelCellName(value = "", expression = "Surname|Second name") <2>
private String surname;
}
----
1. We need to specify the `name` of the column for which the corresponding value is looked. By default, `@ExcelCellName` is case-sensitive and the excel file should't contain duplicated column names. However, you can manipulate this feature using `PoijiOptionsBuilder#caseInsensitive(boolean)` and you can ignore white spaces using `PoijiOptionsBuilder#ignoreWhitespaces(boolean)`.
2. In rare situations a column can have synonyms, especially when the column was renamed and backward compatibility is needed.
Here we specify the `expression` leaving the column `name` empty.

For example, here is the excel (`person.xls`) file we want to use:

|===
| Name |Address |Age |Email
| Name |Address |Age |Email |Surname

|Joe
|San Francisco, CA
|30
|[email protected]
|Doe

|Sophie
|Costa Mesa, CA
|20
|[email protected]
|Doe

|===

Expand All @@ -302,6 +309,7 @@ Person person = people.get(0);
// San Francisco, CA
// 30
// [email protected]
// Doe
----

Given that the first column always stands for the names of people, you're able to combine the `ExcelCell` annotation with `ExcelCellName` in your object model:
Expand Down

0 comments on commit 1c88723

Please sign in to comment.