简体   繁体   中英

How to display special characters in flextable save_as_image routine

Flextable's save_as_image function seems to only understand ASCII characters. Is there a workaround?

Minimal working example

library(flextable)
library(officer)
ft <- flextable(
  head(mtcars),
  col_keys = c("mpg"))
ft <- set_header_labels(ft, mpg = "n°")
ft

library(webshot)
if( require("webshot") ){
  save_as_image(x = ft, path = "./test.png")
}

Expected output

在此处输入图像描述

Actual output

在此处输入图像描述

["

use the unicode value for degree<\/i>

library(flextable)
library(officer)
ft <- flextable(
  head(mtcars),
  col_keys = c("mpg"))
ft <- set_header_labels(ft, mpg = "n\u00b0")
ft

library(webshot)
if( require("webshot") ){
  save_as_image(x = ft, path = "./test.png")
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM