Skip to content
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

CellBlock does not maintain the formatting of the entire column #32

Open
GoogleCodeExporter opened this issue Jul 19, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Hi,

I have been using the xlsx package for a while, it's been very helpful to me. I 
recently noticed a bug when formatting is applied to entire columns and I use 
CellBlock. When using CellBlock with format applied to entire columns, some of 
the cells loose their formatting when saving the workbook. However, if format 
is only applied to cells, this problem doesn't arise. The problem I'm facing in 
my application is that the initial Excel spreadsheets are created by clients 
and they may apply formats over entire columns 

Thanks a lot for your help,
Benoit

Here is a short reproducible example (the files "bad_format.xlsx" and 
"good_format.xlsx" are attached):

library("xlsx")
wb <- loadWorkbook("bad_format.xlsx") #using formatting on entire columns (A to 
L)
sh <- getSheets(wb)
s1 <- sh[[1]]

cb <- CellBlock(sheet = s1, startRow = 1, startCol = 1, noRows = 11, noColumns 
= 50, create = FALSE)
saveWorkbook(wb, "format_lost.xlsx") # some of the formatting is lost (col I to 
L, rows 1 to 11)





wb <- loadWorkbook("good_format.xlsx") #using cells formatting only (columns A 
to L rows 1 to 10,000)
sh <- getSheets(wb)
s1 <- sh[[1]]

cb <- CellBlock(sheet = s1, startRow = 1, startCol = 1, noRows = 11, noColumns 
= 50, create = FALSE)
saveWorkbook(wb, "format_kept.xlsx") # the formatting is kept


Original issue reported on code.google.com by adrian.d...@gmail.com on 13 Feb 2014 at 7:51

Attachments:

@GoogleCodeExporter
Copy link
Author

Can you check that this is still the case in the latest release?  I don't see 
it anymore. 

Thanks

Original comment by adrian.d...@gmail.com on 2 Aug 2014 at 5:48

@GoogleCodeExporter
Copy link
Author

I still see it. If it helps I'm using Excel version 2010 with the following R 
config:

sessionInfo()
R version 3.0.3 (2014-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  

[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                         

[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] xlsx_0.5.7     xlsxjars_0.6.0 rJava_0.9-6   

loaded via a namespace (and not attached):
[1] tools_3.0.3

Original comment by benoit.h...@gmail.com on 4 Aug 2014 at 12:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant