norbert-radyk/spoiwo

Support links to cells

Opened this issue · 0 comments

Apache POI has a feature to create a hyperlink to a cell in the same document. This feature is enabled using enum value Hyperlink.LINK_DOCUMENT:

Hyperlink link2 = createHelper.createHyperlink(Hyperlink.LINK_DOCUMENT);
link2.setAddress("'Target Sheet'!A1");
cell.setHyperlink(link2);
cell.setCellStyle(hlink_style);

(see http://poi.apache.org/components/spreadsheet/quick-guide.html#Hyperlinks)

It looks like in this line

val link = row.getSheet.getWorkbook.getCreationHelper.createHyperlink(HyperlinkType.URL)

protected[natures] def setHyperLinkUrlCell(cell: usermodel.Cell, value: HyperLinkUrl, row: usermodel.Row): Unit = {
    val link = row.getSheet.getWorkbook.getCreationHelper.createHyperlink(HyperlinkType.URL)
    link.setAddress(value.address)
    cell.setCellValue(value.text)
    cell.setHyperlink(link)
  }

only supports URL hyperlinks.
Am I missing something?

What is the best way to add support of different links to the model?