Skip to content

Commit

Permalink
[load] fix <br> fixing in vml files. closes #1061 (#1062)
Browse files Browse the repository at this point in the history
* [load] fix <br> fixing in vml files. closes #1061

* [misc] return(self) to return(invisible(self))
  • Loading branch information
JanMarvin authored Jun 28, 2024
1 parent bc0a282 commit 8b99b77
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/class-style_mgr.R
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ style_mgr <- R6::R6Class("wbStylesMgr", {
got <- self$get_cellStyle_id(name)

if (!is.null(got) && !is.na(got))
return(self)
return(invisible(self))

font_xml <- NULL
fill_xml <- NULL
Expand Down
10 changes: 5 additions & 5 deletions R/class-workbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -4014,7 +4014,7 @@ wbWorkbook <- R6::R6Class(
old <- old %||% seq_along(self$sheet_names)

if (identical(old, new)) {
return(self)
return(invisible(self))
}

if (!length(self$worksheets)) {
Expand All @@ -4030,7 +4030,7 @@ wbWorkbook <- R6::R6Class(
new_name <- replace_legal_chars(new_raw)

if (identical(self$sheet_names[pos], new_name)) {
return(self)
return(invisible(self))
}

bad <- duplicated(tolower(new))
Expand Down Expand Up @@ -4326,7 +4326,7 @@ wbWorkbook <- R6::R6Class(
# should do nothing if the cols' length is zero
# TODO why would cols ever be 0? Can we just signal this as an error?
if (length(cols) == 0L) {
return(self)
return(invisible(self))
}

cols <- col2int(cols)
Expand Down Expand Up @@ -6434,7 +6434,7 @@ wbWorkbook <- R6::R6Class(

if (!protect) {
self$workbook$workbookProtection <- NULL
return(self)
return(invisible(self))
}

# match.arg() doesn't handle numbers too well
Expand Down Expand Up @@ -6490,7 +6490,7 @@ wbWorkbook <- R6::R6Class(
if (!protect) {
# initializes as character()
self$worksheets[[sheet]]$sheetProtection <- character()
return(self)
return(invisible(self))
}

all_props <- worksheet_lock_properties()
Expand Down
2 changes: 1 addition & 1 deletion R/wb_load.R
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ wb_load <- function(
# fix broken xml in vml buttons
vml <- stringi::stri_read_lines(vml, encoding = "UTF-8")
vml <- paste(vml, sep = "", collapse = "")
vml <- gsub("<br>", "<br/>", vml)
vml <- gsub("<br>(?!</br>)", "<br/>", vml, perl = TRUE)
wb$vml[vml_file] <- read_xml(vml, pointer = FALSE)
}

Expand Down

0 comments on commit 8b99b77

Please sign in to comment.