Skip to content

Commit

Permalink
1.3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Oct 24, 2023
1 parent f0dfe4f commit 6234f29
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>cn.devezhao</groupId>
<artifactId>commons</artifactId>
<version>1.3.12</version>
<version>1.3.13</version>
<packaging>jar</packaging>

<name>commons</name>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/cn/devezhao/commons/excel/IRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Cell[] getCells() {
* @return
*/
public Cell getCell(int columnNo) {
return getCells()[columnNo];
return cells.length > columnNo ? cells[columnNo] : null;
}

/**
Expand All @@ -53,7 +53,6 @@ public Cell getCell(String columnName) {
no *= (int) Math.pow(26, i);
columnNo += no;
}

return getCell(columnNo);
}
}
8 changes: 8 additions & 0 deletions src/test/java/cn/devezhao/commons/excel/ExcelReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ public void testIRow() {
System.out.println(row.getCell("R"));
}
}

@Test
public void test() {
System.out.println(new IRow(new Cell[] { Cell.NULL, Cell.NULL }, 0).getCell(0));
System.out.println(new IRow(new Cell[] { Cell.NULL, Cell.NULL }, 0).getCell(1));
System.out.println(new IRow(new Cell[] { Cell.NULL, Cell.NULL }, 0).getCell(2));
System.out.println(new IRow(new Cell[] { Cell.NULL, Cell.NULL }, 0).getCell(21));
}
}

0 comments on commit 6234f29

Please sign in to comment.