Skip to content

Fix/917 docx#918

Open
r2evans wants to merge 4 commits into
haozhu233:masterfrom
r2evans:fix/917-docx
Open

Fix/917 docx#918
r2evans wants to merge 4 commits into
haozhu233:masterfrom
r2evans:fix/917-docx

Conversation

@r2evans
Copy link
Copy Markdown
Contributor

@r2evans r2evans commented Apr 30, 2026

fix #917

This PR supports inline use,

kableExtra::kbl(mtcars[1:8, 1:4], booktabs = TRUE, linesep = "", format = "docx") |>
  kableExtra::kable_styling(latex_options = "striped", stripe_index = c(1,2, 5:6)) |>
  save_kable("foo.png")
# file:////private/var/folders/3f/0hlmq7rx34ddjqtlc1lqbxl80000gn/T/RtmpvBKq7w/fileaa143902958.html screenshot completed
# [1] "foo.png"

as well as Rmd rendering

---
title: "Use kable for DOCX"
output: rmarkdown::word_document
---

```{r}
kableExtra::kbl(mtcars[1:8, 1:4], booktabs = TRUE, linesep = "", format = "docx") |>
  kableExtra::kable_styling(latex_options = "striped", stripe_index = c(1,2, 5:6))
```
rmarkdown::render("vignettes/use_kable_in_docx.Rmd", output_file="foo.docx")

Caveat: I did a global search for format == "html" and shifted to %in% c(..), I do not know if that might not be desired in all cases. Also, the first commit here centralized the warning to reduce how many places to go for updating it (it made sense, I can pull it back if you don't like it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: use webshot2 to enable kableExtra in Rmd->docx

1 participant