Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font size extremely small when exporting table to Word #1740

Open
nikosGeography opened this issue Jul 3, 2024 · 0 comments
Open

Font size extremely small when exporting table to Word #1740

nikosGeography opened this issue Jul 3, 2024 · 0 comments

Comments

@nikosGeography
Copy link

nikosGeography commented Jul 3, 2024

Thank you for creating this amazing package, keep up the good work. I have the following code:

library(gt)
library(dplyr)
library(tibble)

eig_val_adpt <- tibble(
  Dimension = c("PC1", "PC2", "PC3", "PC4"),
  eigenvalue = c(1.9750938, 1.1410984, 0.7621376, 0.1216701),
  variance_percent = c(49.377345, 28.527461, 19.053441, 3.041753),
  cumulative_variance_percent = c(49.37735, 77.90481, 96.95825, 100.00000)
)

gt_table <- gt(eig_val_adpt) %>%
  tab_header(
    title = "PCA eigenvalues and variance explained for the adaptability variables"
  ) %>%
  fmt_number(
    columns = c(eigenvalue, variance_percent, cumulative_variance_percent),
    decimals = 2
  ) %>%
  tab_style(
    style = cell_text(font = "Times New Roman", size = "12px"),
    locations = cells_body()
  ) %>%
  tab_style(
    style = cell_text(font = "Times New Roman", size = "12px"),
    locations = cells_column_labels()
  ) %>%
  tab_style(
    style = cell_text(font = "Times New Roman", size = "14px", weight = "bold"),
    locations = cells_title()
  )

gtsave(gt_table, "path/test.docx")

I even tried to increase the font size. Why is that?

image

R 4.4.0, RStudio 2024.04.2 Build 764, Windows 11.

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

No branches or pull requests

2 participants