awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
364 stars 79 forks source link

conditonal formatting is applied to non-specified rows #500

Open markheckmann opened 4 years ago

markheckmann commented 4 years ago

Expected Behavior

Conditional formatting is applied to specified rows only.

Actual Behavior

Conditional formatting is applied to non-specified rows. It appears that all rows within the min and max specified row number are formatted (e.g. rows = c(1,6) => rows = 1:6).

Steps to Reproduce the Problem

The follwong code should apply formatting to rows 1 and 6 only. However, all rows 1 to 6 are affected.

wb <- createWorkbook()
sheet <- "test"
addWorksheet(wb, sheet)
df <- data.frame(a = rep("", 6)) 
writeData(wb, sheet, df)
ii <- c(1, 6) + 1 # 1 for header
style_pos <- createStyle(fontColour = "#006100", bgFill = "#C6EFCE")
conditionalFormatting(wb, sheet, cols = 1, rows = ii, rule = '=""', style = createStyle(bgFill = "#C6EFCE"))
saveWorkbook(wb, "test.xlsx", overwrite = T)

image

sessionInfo()

hjia222 commented 4 years ago

Hi, I think this repo is discontinued, please refer to issue #497, there is a new repo for openxlsx.