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

Change back-end to use {openxlsx2} #70

Open
matt-dray opened this issue Jun 17, 2022 · 5 comments
Open

Change back-end to use {openxlsx2} #70

matt-dray opened this issue Jun 17, 2022 · 5 comments
Labels
could MoSCoW priority ('on ice') enhancement New feature or request
Milestone

Comments

@matt-dray
Copy link
Owner

matt-dray commented Jun 17, 2022

{openxlsx2} will replace {openxlsx} at some point, presumably? Investigate its potential, but don't integrate until CRAN release and some stability.

@matt-dray matt-dray added could MoSCoW priority ('on ice') code labels Jun 17, 2022
@matt-dray
Copy link
Owner Author

{openxlsx2} has continued to develop and is on CRAN, but it's still not a v1.

There's a vignette to explain some of the changes.

Consider forking {a11ytables} and creating {a11ytables2} (or complete rename) using {openxlsx2}.

@matt-dray
Copy link
Owner Author

matt-dray commented Mar 31, 2023

A nice accessibility feature that appeared in a test of the package is that automatic cell colour is supported through wb_color(auto = "1"). Demo in a Gist.

@matt-dray matt-dray added enhancement New feature or request and removed code labels Dec 27, 2023
@matt-dray matt-dray changed the title Keep an eye on {openxlsx2} Change back-end to use {openxlsx2} Dec 28, 2023
@matt-dray matt-dray added this to the Backlog milestone May 27, 2024
@stanley-rudkin-dluhc
Copy link

Just to say I would find this really useful as it would mean I can use openxlsx2::wb_set_properties on a11ytables workbooks (since I think they need to be openxlsx2-native wbWorkbook objects instead of Workbook objects to use openxlsx2 functions?)

@matt-dray
Copy link
Owner Author

Hi Stanley, thanks for the message. Yeah, as far as I know, {openxlsx} doesn't really have an analogue for openxlsx2::wb_set_properties(), aside from the addCreator() and setLastModifiedBy() functions.

This is definitely something that we're interested in. I've been investigating {openxlsx2} in the {a11ytables2} and {yamlsheets} packages, but they're very much in development and not yet ready for release.

@stanley-rudkin-dluhc
Copy link

Thanks Matt!

Just for anyone having the same problem, I think for now you can adapt some of the commented out code from the openxlsx source code to change the creator (not just add new ones using addCreator()) by replacing strings in the wb$core object as follows:

# Set author name
excel_author_name <- "My name"

# Replace creator in workbook
wb$core <- stringi::stri_replace_all_regex(
wb$core,
pattern = "<dc:creator>(.*?)</dc:creator>",
replacement = paste0("<dc:creator>", excel_author_name, "</dc:creator>"),
)

# Also change last modified by
openxlsx::setLastModifiedBy(accessible_in_year_workbook, excel_author_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
could MoSCoW priority ('on ice') enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants