diff --git a/R/class-workbook-wrappers.R b/R/class-workbook-wrappers.R index 1ff8b592f..df85158a2 100644 --- a/R/class-workbook-wrappers.R +++ b/R/class-workbook-wrappers.R @@ -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 diff --git a/R/class-workbook.R b/R/class-workbook.R index 3108930da..045bf616b 100644 --- a/R/class-workbook.R +++ b/R/class-workbook.R @@ -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( diff --git a/inst/extdata/themes.R b/inst/extdata/themes.R index 80675f86b..768b03b8c 100644 --- a/inst/extdata/themes.R +++ b/inst/extdata/themes.R @@ -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" ) @@ -18,6 +17,7 @@ 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 @@ -25,4 +25,8 @@ for (i in seq_along(fls)) { nms[length(nms)] <- "Old Office Theme" names(themes) <- nms +themes <- themes[order(names(themes))] + +names(themes) %>% dput() + saveRDS(themes, "inst/extdata/themes.rds") diff --git a/man/wb_workbook.Rd b/man/wb_workbook.Rd index 88a44da88..a84baeb91 100644 --- a/man/wb_workbook.Rd +++ b/man/wb_workbook.Rd @@ -34,10 +34,10 @@ Create a new Workbook object } \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