我正在尝试使用officeR包在R中创建一个.docx文件,并且我希望对段落进行解释。在fp_par中,我们使用参数text.align来使文本对齐,但是当right,left和center选项正常工作时,似乎抛出了错误。任何帮助表示赞赏!
bold_lined_face = fp_text(color = "Black", bold = TRUE, underlined = TRUE)
text_format = fp_text(color = "Black", italic = TRUE)
doc <- read_docx() %>%
body_add_fpar(fpar( ftext("This text is right-aligned", prop =
bold_lined_face), fp_p = fp_par(text.align = "right"))) %>%
body_add_fpar(fpar( ftext("This text is justified", prop = text_format ),
fp_p = fp_par(text.align = "justify")))
print(doc, target = "body_add_fpar_1.docx" )