1

I 'am trying to get hyperlink and label of a cell in Excel file using this
library (this library is based on apache POI)

https://github.com/monitorjbl/excel-streaming-reader#supported-methods

I tried this

 InputStream is = new FileInputStream("file");
 Workbook   workbook = StreamingReader.builder().rowCacheSize(100)   
                        .bufferSize(4096)   
                        .open(is);   
 Iterator<Row>    rowIterator=workbook.getSheetAt(0).iterator();
 Row row=rowIterator.next();
 Iterator<Cell> cellIterator = row.cellIterator();
 Cell currentCell = cellIterator.next();
 String parthyperlink=currentCell.getHyperlink().getAddress();
 String label=currentCell.getHyperlink().getLabel();

but I get this Exception

com.monitorjbl.xlsx.exceptions.NotSupportedException at com.monitorjbl.xlsx.impl.StreamingCell.getHyperlink(StreamingCell.java:353) at com.z2data.mapping.ExeclHorizental.getCurrentRow(ExeclHorizental.java:88)

CallumDA
  • 12,025
  • 6
  • 30
  • 52
Elsayed
  • 2,712
  • 7
  • 28
  • 41
  • https://github.com/monitorjbl/excel-streaming-reader/blob/master/src/main/java/com/monitorjbl/xlsx/impl/StreamingCell.java#L432 – Axel Richter Mar 06 '17 at 16:46
  • Why not just use normal Apache POI? – Gagravarr Mar 06 '17 at 23:08
  • @Gagravarr because I have large files and depending on this answer http://stackoverflow.com/questions/11891851/how-to-load-a-large-xlsx-file-with-apache-poi I choose excel-streaming-reader – Elsayed Mar 07 '17 at 07:08

1 Answers1

1

Hyperlink is not a a string. Instantiate a Hyperlink instead. Try this:

Hyperlink h = currentCell.getHyperlink();

You can then fetch the address of the particular cell

if (h == null) {
   System.err.println("Cell didn't have a hyperlink!");
} else {
   System.out.println("Cell : " + h.getLabel() + " -> " + h.getAddress());
}
lakeIn231
  • 1,177
  • 3
  • 14
  • 34