Closed apoorva-sriv closed 1 year ago
@apoorva-sriv yes it should be case insensitive. Can I ask you to double-check which is the resulting column name from the result set by manually printing it? I suspect that the issue could derive from there
The result set has Name
only.
@apoorva-sriv I tested your case and I can't reproduce the issue. This is what I did:
Name
=> this resulted automatically in a NAME
fieldNAME
field to be Name
(pascal case)PreparedStatement prepStmt = connection.prepareStatement("SELECT * FROM MEMPOI.MYTABLE");
Workbook wb = new SXSSFWorkbook();
MempoiColumnConfig mempoiColumnConfig = MempoiColumnConfigBuilder.aMempoiColumnConfig()
.withColumnName("Name")
.withColumnDisplayName("First Name")
.build();
MempoiSheet mempoiSheet = MempoiSheetBuilder.aMempoiSheet()
.withPrepStmt(prepStmt)
.addMempoiColumnConfig(mempoiColumnConfig)
.build();
The resulting file contains the expected "First Name" string as the column header. Please double-check if Oracle automatically capitalized the whole column name, I'm quite sure that this is the problem.
Otherwise please provide me with a way to reproduce your issue
Please double-check if Oracle automatically capitalized the whole column name, I'm quite sure that this is the problem.
Yes, this might likely be the problem, and you couldn't reproduce it because you "forced the NAME
field to be Name
(pascal case)", but that's why I raised the issue here: if both select Name
and select NAME
work in Oracle, then shouldn't both work with MemPOI too? Would it be a good idea to add a case with toUpperCase
inside the definition of withColumnName
?
@apoorva-sriv I thought a bit about your request, but I'm not sure of proceeding with this implementation.
The case sensitiveness must be kept in order to support the various cases and this is a certainty.
We could add the toUpperCase
as you suggest, but is it really needed? I would like to avoid increasing the code complexity if it isn't a requirement, can't we achieve the same goal by adding the right column name in the column configuration?
Am I missing something that prevent you from proceeding in this way?
No, it's not blocking anything. I just thought it might help make the library more intuitive since, if it works with SQL, one might expect it would work here too.
I have a
select Name from Table
query. When I use.withColumnName("Name").withColumnDisplayName("First Name")
,Name
is still the header in Excel. I need to use.withColumnName("NAME")
to make it displayFirst Name
. Shouldn't it be case-insensitive and work in the first case too? (It's the same with bothXSSFWorkbook
andSXSSFWorkbook
.)