library(gt)
tab_1 <-
gtcars |>
dplyr::select(model, year, hp, trq) |>
dplyr::slice(1:5) |>
gt(rowname_col = "model") |>
tab_stubhead(label = "car")
tab_1
tab_1 |> gtsave("tab_1.docx")
==> quarto preview Trial3.qmd --to docx --no-watch-inputs --no-browse
processing file: Trial3.qmd
|............................................. | 86% [unnamed-chunk-3]Unknown output format doc
Pandoc can convert to DOCX, but not to DOC.
Error:
! pandoc document conversion failed with error 22
Backtrace:
global .main()
execute(...)
rmarkdown::render(...)
knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
knitr:::process_file(text, output)
...
base::withRestarts(...)
base (local) withRestartList(expr, restarts)
base (local) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
base (local) docall(restart$handler, restartArgs)
evaluate (local) fun(base::quote(<smplErrr>
))
vedoa
November 9, 2024, 8:13am
2
@robertprince Hi, doc is not supported as an output file format in pandoc.
To make sure (i am assuming you run your command from Rstudio which has a pandoc and quarto version included in the installation) run this:
<YOUR PATH TO RSTUDIO>/RStudio/resources/app/bin/quarto/bin/tools/pandoc --list-output-formats
from a terminal. For me the doc format is not listed hence it will throw the error message.
@vedoa Hi, thank you for a reply.
I ran your command and docx is there. I am not trying to save a doc file.
I am trying to save the gt table as a docx file. The quatro file renders properly without the tab_1 |> gtsave("tab_1.docx") code.
cderv
December 23, 2024, 5:42pm
4
For reference this has been asked in multiple place
system
Closed
March 23, 2025, 5:43pm
5
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.