Skip to content

Commit

Permalink
[write] No cc_out (#1251)
Browse files Browse the repository at this point in the history
* [write] remove cc_out

* [misc] update NEWS
  • Loading branch information
JanMarvin authored Jan 26, 2025
1 parent 93fcb9f commit 925a58b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
## Internal changes

* Update of internal pugixml library
* Switch to `f_attr` to handle more formula attributes
* Remove the use of `cc_out` when writing output files

## Breaking changes

* Style helpers will accept colors only if provided via `wb_color()`. This broke a single example case that was still using `c(rgb = "FF808080")` this can be converted to `wb_color(hex = "FF808080")`.


Expand Down
3 changes: 0 additions & 3 deletions R/class-sheet-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ wbSheetData <- R6::R6Class(
#' @field cc cc
cc = NULL,

#' @field cc_out cc_out
cc_out = NULL,

#' @description
#' Creates a new `wbSheetData` object
#' @return a `wbSheetData` object
Expand Down
8 changes: 4 additions & 4 deletions R/class-workbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -9790,7 +9790,6 @@ wbWorkbook <- R6::R6Class(

cc <- ws$sheet_data$cc


if (!is.null(cc)) {
cc$r <- stringi::stri_join(cc$c_r, cc$row_r)
# prepare data for output
Expand All @@ -9803,12 +9802,13 @@ wbWorkbook <- R6::R6Class(
ws$sheet_data$row_attr <- rows_attr[order(as.numeric(rows_attr[, "r"])), ]

cc_rows <- ws$sheet_data$row_attr$r
cc_out <- cc[cc$row_r %in% cc_rows, c("row_r", "c_r", "r", "v", "c_t", "c_s", "c_cm", "c_ph", "c_vm", "f", "f_attr", "is")]
# c("row_r", "c_r", "r", "v", "c_t", "c_s", "c_cm", "c_ph", "c_vm", "f", "f_attr", "is")
cc <- cc[cc$row_r %in% cc_rows, ]

ws$sheet_data$cc_out <- cc_out[order(as.integer(cc_out[, "row_r"]), col2int(cc_out[, "c_r"])), ]
ws$sheet_data$cc <- cc[order(as.integer(cc[, "row_r"]), col2int(cc[, "c_r"])), ]
} else {
ws$sheet_data$row_attr <- NULL
ws$sheet_data$cc_out <- NULL
ws$sheet_data$cc <- NULL
}

# create entire sheet prior to writing it
Expand Down
2 changes: 1 addition & 1 deletion src/write_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ XPtrXML write_worksheet(std::string prior, std::string post, Rcpp::Environment s
// sheet_data will be in order, just need to check for row_heights
// CharacterVector cell_col = int_to_col(sheet_data.field("cols"));
Rcpp::DataFrame row_attr = Rcpp::as<Rcpp::DataFrame>(sheet_data["row_attr"]);
Rcpp::DataFrame cc = Rcpp::as<Rcpp::DataFrame>(sheet_data["cc_out"]);
Rcpp::DataFrame cc = Rcpp::as<Rcpp::DataFrame>(sheet_data["cc"]);

xmldoc* doc = new xmldoc;
pugi::xml_parse_result result;
Expand Down

0 comments on commit 925a58b

Please sign in to comment.