Skip to content

Commit fb30922

Browse files
committed
[write] fix hyperlink issue with third party class tbl_df. closes #893
In a future version, this spaghetti code should be replaced by something more stable. The conversion to a data frame should be done as soon as possible, and this additional conversion should not be necessary at all.
1 parent 253689e commit fb30922

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

R/write.R

+3
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ write_data_table <- function(
771771
startRow <- as.integer(startRow)
772772

773773
## special case - vector of hyperlinks
774+
# TODO: replace the =HYPERLINK() with the relship hyperlinks
774775
is_hyperlink <- FALSE
775776
if (applyCellStyle) {
776777
if (is.null(dim(x))) {
@@ -789,6 +790,8 @@ write_data_table <- function(
789790
}
790791
class(x[is_hyperlink]) <- c("character", "hyperlink")
791792
} else {
793+
# workaround for tibbles that break with the class assignment below
794+
if (inherits(x, "tbl_df")) x <- as.data.frame(x)
792795
# check should be in create_hyperlink and that apply should not be required either
793796
if (!any(grepl("=([\\s]*?)HYPERLINK\\(", x[is_hyperlink], perl = TRUE))) {
794797
x[is_hyperlink] <- apply(

0 commit comments

Comments
 (0)