[英]How to get conditional formationg of cell in Excel file using Apache POI?
[英]How to get correct cell using Apache POI
我正在一個長度為8的2d數組上工作,我想將所有8個星期一和星期二的時間段存儲在那個2d數組中。我該怎么做呢?我正在使用Apache POI訪問excel。
我搜索了類似的問題,但根據我的需求,它們不夠准確
該論壇的最佳做法是添加您嘗試過的內容並指出您遇到的困難。 不鼓勵您提出一個通用的問題。
由於使用方便,因此我在此處添加了一些粗略的步驟。
private String[][] processExcel(Sheet sheet) {
//initialize whatever dimension of array is required
String[][] arr = new String[3][3];
Iterator<Row> rowIterator = sheet.iterator();
while (rowIterator.hasNext()) {
Row row = rowIterator.next();
String day = processCell(0, row);
/*retrieve what ever info is required based on cell number.*/
}
return arr;
}
private String processCell(Integer cellNo, Row row) {
DataFormatter formatter = new DataFormatter();
return formatter.formatCellValue(row.getCell(cellNo, Row.CREATE_NULL_AS_BLANK)).trim();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.