Flextable not showing up when length of characters in a column in dataframe exceeds a certain length

Flextable fails to show when text in a column in a dataframe exceeds a certain length. Why?
Below is the code:

            if(!is.null(df$Data)&&
               nrow(df$Data) > 0){
              officer::body_add_par(docx,"data",style = "heading 2")
              names(df$Data) <- paste0("V", 1:ncol(df$Data))
              ns <- names(df$Data)
              ft <- flextable::flextable(df$Data)
              ex <- paste0('"',ns, '"', "=NULL", collapse = ",")
              expr <- paste0('flextable::set_header_labels(ft,')
              exp <- paste0(expr, ex, ")")
              ft <- eval(parse(text = exp))
              ft <- flextable::align(ft, part = "all", align = "left")
              ft <- flextable::font(ft, fontname = "Arial")
              ft <- flextable::fontsize(ft, size = 11)
              ft <- flextable::border_remove(ft)
              ft <- flextable::autofit(ft)
              flextable::body_add_flextable(docx, value = ft, align = "left") 

the flextable version used is 0.4.6 and officer version used is 0.3.2.
Any help would be appreciated. Thanks in advance!

Leave a Comment