代码之家  ›  专栏  ›  技术社区  ›  Josh

如何在officer中设置页边距格式?

  •  0
  • Josh  · 技术社区  · 7 年前

    我正试着用R生成Word文档 officer . 这个 documentation (v0.3.5, 06/23/2019) body_end_section body_default_section 已弃用并建议使用 body_end_section_continuous , body_end_section_landscape , body_end_section_portrait body_end_section_columns ,或 body_end_section_columns_landscape 相反。但是,这些函数都不接受 margins

    当我试图强迫 车身端部立柱景观 边距 参数与下面的代码,我得到以下错误:

    my_doc %<>% 
        body_end_section_columns_landscape(
            widths = c(4.75, 4.75),
            space = 0.5, 
            sep = FALSE, 
            w = 8.5, 
            h = 11, 
            margins = c(top = 0.5, bottom = 0.5, left = 0.5, right = 0.5)
        )
    Error in body_end_section_columns_landscape(., widths = c(4.75, 4.75),  : 
      unused argument (margins = c(top = 0.5, bottom = 0.5, left = 0.5, right = 0.5))
    

    车身端部 我收到一个警告,输出有些混乱:

    my_doc %<>% 
        body_end_section(
            landscape = TRUE,
            margins = c(top = 0.5, bottom = 0.5, left = 0.5, right = 0.5),
            colwidths = c(0.5, 0.5),
            space = 0.05
        )
    Warning message:
    body_end_section is deprecated. See ?sections for replacement functions. 
    

    • 纸张是A4(而不是字母)
    • 上、下和左页边距为0.5”(如预期)
    • 右边距为1.04“(而不是0.5”)
    • 柱子宽4.81英寸(而不是4.75英寸)
    • 柱分离器为0.53“(而不是0.5”)

    我看不出一种方法来理解列宽和边距宽度,甚至无法计算A4纸张而不是信纸的宽度。

    我的问题是三个方面:

    1. 如何将纸张大小改为字母?
    2. 如果我必须使用 车身端部 ,谁能解释一下得到我想要的宽度所需要的数学?

    0 回复  |  直到 7 年前