Skip to content

How to include header in table for docx format? #13099

Answered by Steinthal
okenk asked this question in Q&A
Discussion options

You must be logged in to vote

Is this what you have in mind?

---
format: 
  html: default
  docx: default
---

```{r}
#| echo: false
#| label: r-libraries
library(flextable)
library(equatags)
```

```{r}
#| echo: false
#| label: output
data.frame(apples = "L_{A\\min_{2}}", bananas = "\\sigma_R", carrots = 3) |>
  flextable() |>
  compose(j = "apples", value = as_paragraph(as_equation(apples))) |>
  compose(j = "bananas", value = as_paragraph(as_equation(bananas))) |>
  add_header_row( values=c("fruits", " "), colwidths = c(2,1)) |>
  align(align = "center", part = "all")
```

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@cderv
Comment options

Comment options

You must be logged in to vote
5 replies
@Steinthal
Comment options

@okenk
Comment options

@Steinthal
Comment options

Answer selected by okenk
@okenk
Comment options

@cderv
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
tables Issues with Tables including the gt integration docx Issues with the docx format
3 participants