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

hyperlink_text

chunk of text with hyperlink wrapper


Description

The function lets add hyperlinks within flextable objects with function compose(). It should be used inside a call to as_paragraph().

Usage

hyperlink_text(x, props = NULL, formatter = format_fun, url, ...)

Arguments

x

text or any element that can be formatted as text with function provided in argument formatter.

props

an officer::fp_text() object to be used to format the text. If not specified, it will be the default value corresponding to the cell.

formatter

a function that will format x as a character vector.

url

url to be used

...

additional arguments for formatter function.

Note

This chunk option requires package officedown in a R Markdown context with Word output format.

See Also

Other chunk elements for paragraph: as_bracket(), as_b(), as_chunk(), as_equation(), as_highlight(), as_image(), as_i(), as_sub(), as_sup(), colorize(), gg_chunk(), linerange(), lollipop(), minibar(), plot_chunk()

Examples

dat <- data.frame(
  col = "Google it",
  href = "https://www.google.fr/search?source=hp&q=flextable+R+package",
  stringsAsFactors = FALSE)

ftab <- flextable(dat)
ftab <- compose( x = ftab, j = "col",
  value = as_paragraph(
    "This is a link: ",
    hyperlink_text(x = col, url = href ) ) )
ftab

flextable

Functions for Tabular Reporting

v0.6.10
GPL-3
Authors
David Gohel [aut, cre], Clementine Jager [ctb], Quentin Fazilleau [ctb], Maxim Nazarov [ctb] (rmarkdown for docx output), Titouan Robert [ctb], Michael Barrowman [ctb] (inline footnotes), Atsushi Yasumoto [ctb] (support for bookdown cross reference), Paul Julian [ctb] (support for gam objects)
Initial release

We don't support your browser anymore

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