简体   繁体   中英

How to change the font of the first word in the footer of a flextable?

I am trying to build an APA-style Table with flextable , which will be exported to .docx format. I need the first word of the footer to be in italic font, but not the following (footnotes etc.). I haven't been able to do it.

Below is a small example:

require(flextable)

tab <- data.frame("Variable" = c("Reference Norm", "Suject", "Cutoff"), 
                  "Indicators"= c("Content 1", "Content 2", "Content 3"), 
                  "Reference Norm" = c("", "Content 4", "Content 5"), 
                  "Subject" = c("", "", "Content 6"))

tab <- flextable(tab)
tab <- add_footer_lines(tab, values = "Note.") # This is where I need italic font
tab <- footnote(tab, i= 2, j= 2:3 , part = "body", ref_symbols="a", value = as_paragraph("Method x"), inline=T)
require(flextable)

tab <- data.frame(
  "Variable" = c("Reference Norm", "Suject", "Cutoff"),
  "Indicators" = c("Content 1", "Content 2", "Content 3"),
  "Reference Norm" = c("", "Content 4", "Content 5"),
  "Subject" = c("", "", "Content 6")
)

tab <- flextable(tab)

# start with an empty line
tab <- add_footer_lines(tab, values = "")
# add "Note: "
tab <- compose(tab, i = 1, j = 1, value = as_paragraph(as_i("Note: ")), part = "footer")

# add some footnotes
tab <- footnote(tab, i = 2, j = 2:3, part = "body", ref_symbols = "a", sep = "", value = as_paragraph("Method x"), inline = T)
# add other footnotes
tab <- footnote(tab, i = 3, j = 1, part = "body", ref_symbols = "b", sep = "; ", value = as_paragraph("Method y"), inline = T)

tab <- fontsize(tab, part = "all", size = 13)
autofit(tab)

在此处输入图片说明

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