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:

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