ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
225 stars 75 forks source link

Repeated newlines are combined into one when reading XLSX on Windows #462

Open uhkeller opened 8 months ago

uhkeller commented 8 months ago

Describe the bug When reading an XLSX file with multiple consecutive newlines ("\r\n"), on Windows these are incorrectly combined into a single "\n".

To Reproduce Using a Windows machine, read the attached example file and observe the incorrect cell value:

library(openxlsx)
read.xlsx("data.xlsx")
#>                      column
#> 1 some text\nsome more text

Created on 2024-01-23 with reprex v2.1.0

Expected behavior On macOS, reading the attached file works as expected:

library(openxlsx)
read.xlsx("data.xlsx")
#>                            column
#> 1 some text\r\n\r\nsome more text

Created on 2024-01-23 with reprex v2.1.0

Example files data.xlsx

Additional context Both systems are using R 4.3.2, openxlsx 4.2.5.2, Rcpp 1.0.12, stringi 1.8.3, zip 2.3.0, installed from CRAN using precompiled binaries. The files was created using Excel on a Mac. New lines were entered using Option+Enter.