Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addHyperlink

Add a hyperlink to a cell.


Description

Add a hyperlink to a cell to point to an external resource.

Usage

addHyperlink(
  cell,
  address,
  linkType = c("URL", "DOCUMENT", "EMAIL", "FILE"),
  hyperlinkStyle = NULL
)

Arguments

cell

a Cell object.

address

a string pointing to the resource.

linkType

a the type of the resource.

hyperlinkStyle

a CellStyle object. If NULL a default cell style is created, blue underlined font.

Details

The cell needs to have content before you add a hyperlink to it. The contents of the cells don't need to be the same as the address of the hyperlink. See the examples.

Value

None. The modification to the cell is done in place.

Author(s)

Adrian Dragulescu

Examples

wb <- createWorkbook()
  sheet1 <- createSheet(wb, "Sheet1")
  rows   <- createRow(sheet1, 1:10)              # 10 rows
  cells  <- createCell(rows, colIndex=1:8)       # 8 columns

  ## Add hyperlinks to a cell
  cell <- cells[[1,1]]
  address <- "https://poi.apache.org/"
  setCellValue(cell, "click me!")
  addHyperlink(cell, address)

  # Don't forget to save the workbook ...

xlsx

Read, Write, Format Excel 2007 and Excel 97/2000/XP/2003 Files

v0.6.5
GPL-3
Authors
Adrian Dragulescu [aut], Cole Arendt [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.