Reputation: 514
I'm currently working on a project where I need to edit XLS with Java. The first row of the xls is a row with columnnames. I want to use the columnname to insert data in the cells below. Instead of using getCell to insert a prefix number, I want the application to use a variable string to insert the data. (The comment part is info I scribbled for myself; it might be useful).
Upvotes: 0
Views: 1369
Reputation: 577
Create a Map to store the ColumnName and Index.
You can use objMap.get(columnName) whenever you need the index to passed to the cell.
Upvotes: 1
Reputation: 1624
I would done like this:
Map
objectMap
row.getCell (theNameIndexMap.get("A_COLUMN_NAME"))
would meet your requirementAnd, make sure each column name is UNIQUE...
Upvotes: 3