a question from a new user when reading openxlsx2 book #1164
Replies: 1 comment 1 reply
-
Hi @anticmason , thanks for asking! (I just converted the issue to a discussion). Ultimately it boils down to lazy coding as in ... if it works this way, why bother with further tweaking. In the internals of Line 1049 in 665b620 We can see how R handles this: values <- "'O1,O2'"
sprintf("<formula%s>%s</formula%s>", 1, values, 1)
#> [1] "<formula1>'O1,O2'</formula1>"
values <- '"O1,O2"'
sprintf("<formula%s>%s</formula%s>", 1, values, 1)
#> [1] "<formula1>\"O1,O2\"</formula1>" As we can see, only the second variant returns the expected outcome. Excel has many cases in which it more sloppy with the XML input - and other spreadsheet software as well, e.g. it might be perfectly fine for LibreOffice - but here Excel is picky for some reason. The ECMA OOXML specifications are not helpful in this case (see below), therefore I assume that it was reverse engineering that revealed the hidden magic Excel demands.
ECMA-376 Part 1, 18. SpreadsheetML Reference Material (p. 1635) When I mentioned sloppy coding, I guess we could try to capture |
Beta Was this translation helpful? Give feedback.
-
Hi,
I‘m the new user for the package:openxlsx2.
Recently, I'm reading the openxlsx2 book, I've encountered a question in the chapter " Data Validation", code related shown as follows:
Why should parameter "value" be shown as ' "O1,O2" ', when I try to change it to
" 'O1,O2' ",it didn't work but sending a warning in excel...
Could you please explain the reason.....
Thanks a lot ~
Beta Was this translation helpful? Give feedback.
All reactions