Skip to content

Commit

Permalink
order and remove duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
JanMarvin committed May 28, 2023
1 parent f515873 commit ba05a35
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions R/class-workbook-wrappers.R
Expand Up @@ -16,10 +16,10 @@
#'
#' @details
#' "Atlas", "Badge", "Berlin", "Celestial", "Crop", "Depth", "Droplet",
#' "Facet", "Feathered", "Gallery", "Headlines", "Integral", "Ion Boardroom",
#' "Ion", "Madison", "Main Event", "Mesh", "Office Theme", "Organic",
#' "Parallax", "Parcel", "Retrospect", "Savon", "Slice", "Vapor Trail",
#' "View", "Wisp", "Wood Type", "Office Theme", "Old Office Theme"
#' "Facet", "Feathered", "Gallery", "Headlines", "Integral", "Ion",
#' "Ion Boardroom", "Madison", "Main Event", "Mesh", "Office Theme",
#' "Old Office Theme", "Organic", "Parallax", "Parcel", "Retrospect",
#' "Savon", "Slice", "Vapor Trail", "View", "Wisp", "Wood Type"
#'
#' @examples
#' ## Create a new workbook
Expand Down
2 changes: 1 addition & 1 deletion R/class-workbook.R
Expand Up @@ -257,7 +257,7 @@ wbWorkbook <- R6::R6Class(
self$theme <- stringi::stri_unescape_unicode(themes[[sel]])

# create the default font for the style
font_scheme <- xml_node(wb$theme, "a:theme", "a:themeElements", "a:fontScheme")
font_scheme <- xml_node(self$theme, "a:theme", "a:themeElements", "a:fontScheme")
minor_font <- xml_attr(font_scheme, "a:fontScheme", "a:minorFont", "a:latin")[[1]][["typeface"]]

self$styles_mgr$styles$fonts <- create_font(
Expand Down
6 changes: 5 additions & 1 deletion inst/extdata/themes.R
Expand Up @@ -5,7 +5,6 @@ library(openxlsx2)
# local clone from https://github.com/JanMarvin/openxlsx-data
fls <- c(
dir("../openxlsx-data/styles", full.names = TRUE, pattern = ".xlsx"),
"../openxlsx-data/connection.xlsx",
"../openxlsx-data/loadExample.xlsx"
)

Expand All @@ -18,11 +17,16 @@ for (i in seq_along(fls)) {

xml_theme <- wb$theme
xml_name <- xml_attr(xml_theme, "a:theme")[[1]][["name"]]
message(xml_name, " ", fls[i])

themes[[i]] <- stringi::stri_escape_unicode(xml_theme)
nms[[i]] <- xml_name
}
nms[length(nms)] <- "Old Office Theme"
names(themes) <- nms

themes <- themes[order(names(themes))]

names(themes) %>% dput()

saveRDS(themes, "inst/extdata/themes.rds")
8 changes: 4 additions & 4 deletions man/wb_workbook.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba05a35

Please sign in to comment.