【问题标题】:officer: Insert section break with landscape format in .rmd-file官员:在 .rmd 文件中插入横向格式的分节符
【发布时间】:2023-04-02 06:21:01
【问题描述】:

我想在 word 文档中包含一个宽弹性表格,以便它显示在横向页面上。

officeverse-guidebook (https://ardata-fr.github.io/officeverse/index.html) 包含有关如何在 Rmarkdown 中添加格式化段落或表格的示例。然而,它缺少一个示例,说明如何结合表格或图形解决纸张格式从纵向到横向再返回的问题。

这个方法我试过了

# Appendix
## Timing

<!---BLOCK_LANDSCAPE_START--->

```{r, include=T}
tibble("Age of inclusion" = c("13 - 28"," ","20 - 28","22 - 28","24 - 28","26 - 28","28"),
      "1" = c("Graffities","Purse snatching","Driving w/o permit","Illegal\nemployment","Ill. advantage\nover employer","False claims\n(insurance)","Paying for\nservice w/o bill"),
      "2" = c("Scratching","Robbery","Hit and run","Drunk driving","Ill. advantage\nfor employer","False claims\n(public agency)","Illicit upload of\nproprietary media"),
      "3" = c("Vandalism","Burglary","Partner violence"," "," ","Tax evasion"," "),
      "4" = c("Machine theft","Other thefts"," "," "," ","False\nrepresentation\n(sale of goods)"," "),
      "5" = c("Shoplifting","Accepting\nstolen goods"," "," "," ","Selling goods w/o\nintent to deliver"," "),
      "6" = c("Bicycle theft","Aggrav. assault\nw/o a weapon"," "," "," ","Fraudul.\ninducement\nto contract"," "),
      "7" = c("Motor-vehicle\ntheft","Aggrav. assault\nwith a weapon"," "," "," "," "," "),
      "8" = c("Theft out of vehicle","Drug dealing"," "," "," "," "," ")) %>%
flextable %>% 
flextable::align(j=1, align = "left", part = "all") %>% 
bold(j = 1, bold = T) %>%
bold(i = 1, bold = T, part = "header") %>%
set_caption(table_nums("timing")) %>%
fit_to_width(max_width = 6.5, max_iter = 2)
```

<!---BLOCK_LANDSCAPE_end--->

Lorem ipsum …

无济于事。

任何帮助将不胜感激。

最好, 乔治

【问题讨论】:

  • 这里有一个关于部分的章节,其中包含您所要求的示例:ardata-fr.github.io/officeverse/…
  • 对不起,我回复得太快了,你问的是用 R markdown 做的,而不是官员

标签: ms-word markdown landscape flextable officedown


【解决方案1】:

这是一个例子:

---
date: "`r Sys.Date()`"
author: "Your Name"
title: "officedown template"
output: 
  officedown::rdocx_document:
    mapstyles:
      Normal: ['First Paragraph']
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, fig.cap = TRUE)
library(officedown)
library(officer)
library(flextable)
op_section <- prop_section(type = "continuous")
close_section <- prop_section(
    page_size = page_size(orient = "landscape"), 
    type = "continuous")
```

```{r}
block_section(op_section)
```

```{r}
qflextable(head(mtcars))
```

```{r}
block_section(close_section)
```

您可以在此处阅读有关块的更多信息:

https://ardata-fr.github.io/officeverse/officedown-for-word.html#add-blocks

【讨论】:

    猜你喜欢
    • 2019-02-09
    • 2020-04-30
    • 2012-05-31
    • 1970-01-01
    • 2022-01-21
    • 2022-04-07
    • 1970-01-01
    • 1970-01-01
    • 2016-09-24
    相关资源
    最近更新 更多