-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoding #207
Conversation
…vironment. This needs further clean ups and additional fixes for writing. Currently this breaks reading and writing on utf8 too. Needs some additional option when to set which pugi::encoding.
Maybe I have a working version, after 10+h of starring at the computer and old R and old Windows problems (a fix for the past) A strange thing I've encountered, somehow the comment got duplicated. Either it is written incorrectly or something else is broken. library(openxlsx2)
# to test
wb <- wb_workbook()$
add_worksheet("höhö")$
add_data("höhö", "bää", colNames = FALSE)
c1 <- create_comment(text = "this is ä cömment", author = "öpenxlsx2 äüthör")
write_comment(wb, 1, col = "B", row = 10, comment = c1)
names(wb)
wb$sheet_names
wb_to_df(wb)
wb$save("test0.xlsx")
# new xlsx file
wb <- wb_load("test0.xlsx")
names(wb1)
wb$sheet_names
wb_to_df(wb)
wb$save("test1.xlsx")
unlink("test0", recursive = TRUE)
unlink("test1", recursive = TRUE)
unzip("test0.xlsx", exdir = "test0")
unzip("test1.xlsx", exdir = "test1") |
Codecov Report
@@ Coverage Diff @@
## main #207 +/- ##
==========================================
+ Coverage 83.24% 83.39% +0.14%
==========================================
Files 36 36
Lines 7414 7425 +11
==========================================
+ Hits 6172 6192 +20
+ Misses 1242 1233 -9
Continue to review full report at Codecov.
|
… no conversion is required
Encoding xptrxml
this only needs minor cleanups, otherwise it should be good to go. confirmed at my work PC with some antique xlsm file. unfortunately it will not make the broken Rstudio go away 😄 |
Encoding ... my old friend.
Been wrangling with it for some time now, it's still a draft and I still don't know what exactly is going wrong inside :)It's working. Only negative side effect I see right now: saving larger files has become slower. Previously we simply threw everything bit by bit into a sheet.xml. Now we construct everything in Rcpp as a single character, return it to R, pass this file back to Rcpp and pugi. Here we load it, apply the encoding and save it. Therefore in my benchmark saving is now on par with
openxlsx
. Guess we can bring that down again, if we construct it in a XML pointer and pass this to the function that saves the file. Something to figure out in a follow up PR.session
test