Skip to content

Commit 0805152

Browse files
committed
support cell getAddress
1 parent 060d55a commit 0805152

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/main/java/com/github/pjfanning/xlsx/impl/StreamingCell.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ public LocalDateTime getLocalDateTimeCellValue() {
340340
return rawContents == null ? null : DateUtil.getLocalDateTime(getNumericCellValue(), use1904Dates);
341341
}
342342

343+
@Override
344+
public CellAddress getAddress() {
345+
return new CellAddress(this);
346+
}
347+
343348
/* Not supported */
344349

345350
/**
@@ -460,14 +465,6 @@ public void setAsActiveCell() {
460465
throw new NotSupportedException("update operations are not supported");
461466
}
462467

463-
/**
464-
* Not supported
465-
*/
466-
@Override
467-
public CellAddress getAddress() {
468-
throw new NotSupportedException();
469-
}
470-
471468
/**
472469
* Update operations are not supported
473470
*/

src/test/java/com/github/pjfanning/xlsx/StreamingReaderTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,8 @@ public void testIteration() throws Exception {
643643
for(Cell c : r) {
644644
assertNotNull("cell row is set", c.getRow());
645645
assertEquals(r, c.getRow());
646+
assertNotNull("cell address is set", c.getAddress());
647+
assertEquals(r.getRowNum(), c.getAddress().getRow());
646648
}
647649
}
648650
}

0 commit comments

Comments
 (0)