Hi! Playing around with your package and the dev version of RStudio, I've noticed that gt tables don't print with any formatting when output to .pptx, instead just printing raw text. Two solutions I can see, in ascending order of complexity: 1) Output the formatted table as an immutable image and 2) Output into a native .pptx tables
Reprex:
---
title: "pptx_test"
output: powerpoint_presentation
---
```{r setup, include=FALSE}
library(gt)
library(tidyverse)
library(glue)
```
## Slide with GT output
```{r cars, echo = FALSE}
# Define the start and end dates for the data range
start_date <- "2010-06-07"
end_date <- "2010-06-14"
# Create a gt table based on preprocessed
# `sp500` table data
sp500 %>%
dplyr::filter(date >= start_date & date <= end_date) %>%
dplyr::select(-adj_close) %>%
dplyr::mutate(date = as.character(date)) %>%
gt() %>%
tab_header(
title = "S&P 500",
subtitle = glue::glue("{start_date} to {end_date}")
) %>%
fmt_date(
columns = vars(date),
date_style = 3
) %>%
fmt_currency(
columns = vars(open, high, low, close),
currency = "USD"
) %>%
fmt_number(
columns = vars(volume),
scale_by = 1 / 1E9,
pattern = "{x}B"
)
```
The text was updated successfully, but these errors were encountered:
Thanks for the feature request, and it sounds like a good one!
The first option would be great and certainly would be great for a variety of use cases (and it's requested in #96). I'm not sure how much work the second option would entail but I agree it would be a step up from the first option.
I've done some looking into the first option (image output) and I'm trying to find a solution. It seems like using webshot might work. Another option (difficult though) would be to create SVG output (in much the same way we create HTML output) and then use rsvg to convert to different image formats. There are probably other solutions as well (I'm hoping they might be easier/better).
Hi! Playing around with your package and the dev version of RStudio, I've noticed that
gttables don't print with any formatting when output to .pptx, instead just printing raw text. Two solutions I can see, in ascending order of complexity: 1) Output the formatted table as an immutable image and 2) Output into a native .pptx tablesReprex:
The text was updated successfully, but these errors were encountered: