Révision 3229
tmp/org.txm.utils/src/org/txm/utils/TableReader.java (revision 3229) | ||
---|---|---|
41 | 41 |
public static ArrayList<ArrayList<String>> readAsList(File tableFile) throws Exception { |
42 | 42 |
ArrayList<ArrayList<String>> result = new ArrayList<>(); |
43 | 43 |
|
44 |
TableReader reader = new TableReader(tableFile); |
|
44 |
TableReader reader = new TableReader(tableFile, null);
|
|
45 | 45 |
reader.readHeaders(); |
46 | 46 |
while (reader.readRecord()) { |
47 | 47 |
ArrayList<String> line = new ArrayList<>(); |
... | ... | |
84 | 84 |
} |
85 | 85 |
|
86 | 86 |
public TableReader(File tableFile) throws Exception { |
87 |
this(tableFile, null); |
|
88 |
} |
|
89 |
|
|
90 |
public TableReader(File tableFile, String sheet) throws Exception { |
|
87 | 91 |
this.tableFile = tableFile; |
88 | 92 |
|
89 | 93 |
if (tableFile.getName().toLowerCase().endsWith(".xlsx")) { |
90 | 94 |
mode = "excel"; |
91 |
excelReader = new ReadExcel(tableFile, null);
|
|
95 |
excelReader = new ReadExcel(tableFile, sheet);
|
|
92 | 96 |
} else if (tableFile.getName().toLowerCase().endsWith(".ods")) { |
93 | 97 |
mode = "ods"; |
94 |
odsReader = new ReadODS(tableFile, null);
|
|
98 |
odsReader = new ReadODS(tableFile, sheet);
|
|
95 | 99 |
} else if (tableFile.getName().toLowerCase().endsWith(".tsv")) { |
96 | 100 |
tsvReader = new CsvReader(tableFile.getAbsolutePath(), "\t".charAt(0), Charset.forName("UTF-8")); |
97 | 101 |
mode = "tsv"; |
Formats disponibles : Unified diff