diff --git a/DESCRIPTION b/DESCRIPTION index ab44cc89..0138f6a6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tinytable Type: Package -Title: Simple and Configurable Tables in 'HTML', 'LaTeX', and 'Markdown' +Title: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', and 'Word' Description: Create highly customized tables with this simple and dependency-free package. Data frames can be converted to 'HTML', 'LaTeX', or 'Markdown' tables. The user interface is minimalist and the syntax concise. 'HTML' tables can be customized using the flexible 'Bootstrap' framework, and 'LaTeX' code with the 'tabularray' package. Version: 0.0.1 Depends: diff --git a/R/save_tt.R b/R/save_tt.R index 33c580c9..ebbbc6f2 100644 --- a/R/save_tt.R +++ b/R/save_tt.R @@ -5,7 +5,8 @@ #' @param x The tinytable object to be saved. #' @param output String or file path. #' + If `output` is "markdown", "latex", or "html", the table is returned in a string as an `R` object. -#' + If `output` is a valid file path, the table is saved to file. The supported extensions are: .html, .png, .pdf, .tex and .md (with aliases .txt, .Rmd and .qmd). +#' + If `output` is a valid file path, the table is saved to file. The supported extensions are: .docx, .html, .png, .pdf, .tex and .md (with aliases .txt, .Rmd and .qmd). +#' + Warning: `style_tt()` does not work for Markdown or Word tables. #' @param overwrite A logical value indicating whether to overwrite an existing file. #' @return A string or `TRUE` when the table is written to file. #' @export diff --git a/man/save_tt.Rd b/man/save_tt.Rd index 623f127b..1133f40a 100644 --- a/man/save_tt.Rd +++ b/man/save_tt.Rd @@ -12,7 +12,8 @@ save_tt(x, output, overwrite = FALSE) \item{output}{String or file path. \itemize{ \item If \code{output} is "markdown", "latex", or "html", the table is returned in a string as an \code{R} object. -\item If \code{output} is a valid file path, the table is saved to file. The supported extensions are: .html, .png, .pdf, .tex and .md (with aliases .txt, .Rmd and .qmd). +\item If \code{output} is a valid file path, the table is saved to file. The supported extensions are: .docx, .html, .png, .pdf, .tex and .md (with aliases .txt, .Rmd and .qmd). +\item Warning: \code{style_tt()} does not work for Markdown or Word tables. }} \item{overwrite}{A logical value indicating whether to overwrite an existing file.} diff --git a/vignettes/tutorial.qmd b/vignettes/tutorial.qmd index 8f857d57..a78c8906 100644 --- a/vignettes/tutorial.qmd +++ b/vignettes/tutorial.qmd @@ -12,7 +12,7 @@ format: \clearpage -`tinytable` is a small but powerful `R` package to draw HTML, LaTeX, PDF, Markdown, and Typst tables. The interface is minimalist, but it gives users direct and convenient access to powerful frameworks to create endlessly customizable tables. +`tinytable` is a small but powerful `R` package to draw HTML, LaTeX, Word, PDF, Markdown, and Typst tables. The interface is minimalist, but it gives users direct and convenient access to powerful frameworks to create endlessly customizable tables. Install it from Github: @@ -48,7 +48,7 @@ tt(x) ## Output formats -`tinytable` can produce tables in HTML, Markdown, LaTeX, PDF, or PNG format. An appropriate output format for printing is automatically selected based on (1) whether the function is called interactively, (2) is called within RStudio, and (3) the output format of the Rmarkdown or Quarto document, if applicable. Alternatively, users can specify the print format in `print()` or by setting a global option: +`tinytable` can produce tables in HTML, Word, Markdown, LaTeX, PDF, or PNG format. An appropriate output format for printing is automatically selected based on (1) whether the function is called interactively, (2) is called within RStudio, and (3) the output format of the Rmarkdown or Quarto document, if applicable. Alternatively, users can specify the print format in `print()` or by setting a global option: ```{r} #| eval: false @@ -59,11 +59,12 @@ tt(x) |> print("latex") options(tinytable_print_output = "markdown") ``` -With the `save_tt()` function, users can also save tables directly to PNG images or PDF documents, or any of the basic formats. All we need to do is supply a valid file name with the appropriate extension (ex: `.png`, `.html`, `.pdf`, etc.): +With the `save_tt()` function, users can also save tables directly to PNG (images), PDF or Word documents, and to any of the basic formats. All we need to do is supply a valid file name with the appropriate extension (ex: `.png`, `.html`, `.pdf`, etc.): ```r tt(x) |> save_tt("path/to/file.png") tt(x) |> save_tt("path/to/file.pdf") +tt(x) |> save_tt("path/to/file.docx") tt(x) |> save_tt("path/to/file.html") tt(x) |> save_tt("path/to/file.tex") tt(x) |> save_tt("path/to/file.md")