@@ -9782,40 +9782,43 @@ wbWorkbook <- R6::R6Class(
9782
9782
}
9783
9783
} else {
9784
9784
# # Write worksheets
9785
- ws <- self $ worksheets [[i ]]
9786
- hasHL <- length(ws $ hyperlinks ) > 0
9785
+ # ws <- self$worksheets[[i]]
9786
+ hasHL <- length(self $ worksheets [[ i ]] $ hyperlinks ) > 0
9787
9787
9788
- prior <- ws $ get_prior_sheet_data()
9789
- post <- ws $ get_post_sheet_data()
9788
+ prior <- self $ worksheets [[ i ]] $ get_prior_sheet_data()
9789
+ post <- self $ worksheets [[ i ]] $ get_post_sheet_data()
9790
9790
9791
- if (! is.null(ws $ sheet_data $ cc )) {
9791
+ if (! is.null(self $ worksheets [[ i ]] $ sheet_data $ cc )) {
9792
9792
9793
- cc <- ws $ sheet_data $ cc
9794
- cc $ r <- stringi :: stri_join(cc $ c_r , cc $ row_r )
9793
+ self $ worksheets [[i ]]$ sheet_data $ cc $ r <- with(
9794
+ self $ worksheets [[i ]]$ sheet_data $ cc ,
9795
+ stringi :: stri_join(c_r , row_r )
9796
+ )
9797
+ cc <- self $ worksheets [[i ]]$ sheet_data $ cc
9795
9798
# prepare data for output
9796
9799
9797
9800
# there can be files, where row_attr is incomplete because a row
9798
9801
# is lacking any attributes (presumably was added before saving)
9799
9802
# still row_attr is what we want!
9800
9803
9801
- rows_attr <- ws $ sheet_data $ row_attr
9802
- ws $ sheet_data $ row_attr <- rows_attr [order(as.numeric(rows_attr [, " r" ])), ]
9804
+ rows_attr <- self $ worksheets [[ i ]] $ sheet_data $ row_attr
9805
+ self $ worksheets [[ i ]] $ sheet_data $ row_attr <- rows_attr [order(as.numeric(rows_attr [, " r" ])), ]
9803
9806
9804
- cc_rows <- ws $ sheet_data $ row_attr $ r
9807
+ cc_rows <- self $ worksheets [[ i ]] $ sheet_data $ row_attr $ r
9805
9808
# c("row_r", "c_r", "r", "v", "c_t", "c_s", "c_cm", "c_ph", "c_vm", "f", "f_attr", "is")
9806
9809
cc <- cc [cc $ row_r %in% cc_rows , ]
9807
9810
9808
- ws $ sheet_data $ cc <- cc [order(as.integer(cc [, " row_r" ]), col2int(cc [, " c_r" ])), ]
9811
+ self $ worksheets [[ i ]] $ sheet_data $ cc <- cc [order(as.integer(cc [, " row_r" ]), col2int(cc [, " c_r" ])), ]
9809
9812
} else {
9810
- ws $ sheet_data $ row_attr <- NULL
9811
- ws $ sheet_data $ cc <- NULL
9813
+ self $ worksheets [[ i ]] $ sheet_data $ row_attr <- NULL
9814
+ self $ worksheets [[ i ]] $ sheet_data $ cc <- NULL
9812
9815
}
9813
9816
9814
9817
# create entire sheet prior to writing it
9815
9818
sheet_xml <- write_worksheet(
9816
9819
prior = prior ,
9817
9820
post = post ,
9818
- sheet_data = ws $ sheet_data
9821
+ sheet_data = self $ worksheets [[ i ]] $ sheet_data
9819
9822
)
9820
9823
ws_file <- file.path(xlworksheetsDir , sprintf(" sheet%s.xml" , i ))
9821
9824
write_xmlPtr(doc = sheet_xml , fl = ws_file )
0 commit comments