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

Allow for a normal data.frame to be converted to Govspeak #12

Open
matt-dray opened this issue Nov 18, 2023 · 0 comments
Open

Allow for a normal data.frame to be converted to Govspeak #12

matt-dray opened this issue Nov 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@matt-dray
Copy link
Owner

Would be nice to be able to convert from a data.frame to Govspeak to allow for extraction and conversion of all tables found in a Word doc, as per matt-dray/govspeakify-tables#2.

library(officer)

doc_1 <- officer::read_docx() |>
  body_add_par("Hello world!", style = "heading 1") |>
  body_add_par("", style = "Normal") |>
  body_add_table(airquality, style = "table_template") |> 
  body_add_par("Hello world!", style = "heading 1") |>
  body_add_par("", style = "Normal") |>
  body_add_table(iris, style = "table_template") |> 
  body_add_par("Hello world!", style = "heading 1") |>
  body_add_par("", style = "Normal") |>
  body_add_table(mtcars, style = "table_template")

print(doc_1, target = "~/Desktop/example_1.docx")

tables <- docxtractr::read_docx("~/Desktop/example_1.docx") |> 
  docxtractr::docx_extract_all_tbls()

lapply(tables, wordup::table_to_govspeak)  # errors, doesn't expect a df
@matt-dray matt-dray added the enhancement New feature or request label Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant