Debby Zemlock
Debby Zemlock

Reputation: 45

Flex Table objects are not showing up in R Markdown only when opened from a SharePoint Link

My office works exclusively in SharePoint, and I have run into a problem when generating HTML outputs in R Markdown, using flex tables.

When Printing the flex tables, the HTML file displays the correct formatting in the R viewer and when opening the HTML file from a local library, but when the HTML file is opened from a link in SharePoint, the flex table objects disappear.

Below is an example code that I got from another post to test out saving flex table outputs opened in multiple ways?


library(flextable)

#create example df
df1 <- data.frame(col1=c("a","b","c"),
        col2=c("1","2","3"))
df2 <- data.frame(col1=c("d","e","f"),
                  col2=c("4","5","6"))
ft1 <- flextable(df1)
set_caption(ft1, "I love R language")

\newpage

ft2 <- flextable(df2)
set_caption(ft2, "I hope, it loves me too")

\newpage

(Click, here is the first table)

(Here is the second)


Has anyone run into this and found a solution?

I am a fan of flex tables, so I would like to keep using them, but the HTML files have to open with just the click of a link. I know I can save the flex table as an image and read it back in as an image, but I want a more elegant solution.

Upvotes: 0

Views: 401

Answers (1)

Mark Burdon
Mark Burdon

Reputation: 13

I can confirm for others finding this on Google that @DavidGohel 's solution in the comments worked for me:

I don't know well sharepoint but maybe it is not compatible with "shadow DOM". Could you try to desactivate it by using chunk option ft.shadow=FALSE in the knitr options (knitr::opts_chunk$set(ft.shadow = FALSE))?

Upvotes: 1

Related Questions