1

I create a Word document, I need Arial paragraphs with heading styles:

doc2 = body_add_par(doc2, 'text', style = 'heading 4')

Creates a Times New Roman font paragraph, but I need Arial, and this attempt gives me Warnings:

doc2 = body_add_par(doc2, ftext('text', prop = fp_text(
    color = "#434343",
    font.size = 12,
    bold = FALSE,
    italic = FALSE,
    underlined = FALSE,
    font.family = "Arial"
)), style = 'heading 4')

Warning messages: 1: In if (grepl("<|>", x)) { : the condition has length > 1 and only the first element will be used 2: In charToRaw(enc2utf8(x)) : argument should be a character vector of length 1 all but the first element will be ignored

Q: can I make a heading-4 paragraph with Arial font?

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
  • 2
    You need to create and format it in your Word template – David Gohel Apr 27 '20 at 09:15
  • 1
    @DavidGohel, hello. Can you please give an example of this? I am not sure how to proceed. – alexeymosco Apr 27 '20 at 09:24
  • 2
    I don't have specific resource for Word usage. Try this video https://youtu.be/OnmETSz7q9A?t=110 – David Gohel Apr 27 '20 at 10:40
  • 1
    @DavidGohel, I have just watched this video. Thank you! So, I can create a custom heading in my template and call its name in add_par(...)? – alexeymosco Apr 27 '20 at 11:35
  • 2
    yes exactly with `body_add_par(..., stylename = "heading 4")`. See also function `style_info`. By this way, you are free to define easily any formatting and reuse them. I am thinking about making a vignette with ressoources for explaining that kind of things. – David Gohel Apr 27 '20 at 11:55

0 Answers0