awalker89/openxlsx

conditionalFormatting: "Catastrophic failure" with databar

Opened this issue · 2 comments

Expected Behavior

Function conditionalFormatting with type = "databar" should format the column as a databar

Actual Behavior

All of the variant calls I have tested corrupt the formatting of the worksheet. When opening the worksheet in Excel, the program reports that it found a problem with the workbook and offers to repair the records. It then reports repairing a catastrophic failure (strangely, at line 15, column 0 - which has nothing to do with the target column). The "databar" formatting of the target column is lost, and in addition all formatting in columns right of the target column disappears.

In addition, the help says that "style" should be length 2 or 3, but if length 3 is used, an error says it should be length 1 or 2.

Steps to Reproduce the Problem

(please attach an example xlsx file if possible)

  1. Create wb with one sheet and write one column of numerical data
  wb <- createWorkbook()
  sheet  <- addWorksheet(wb, "Protein Data")
  writeData(wb, "Protein Data", rep(1, 10))
  1. Function call (all the variants I tested failed):
    conditionalFormatting(wb, 1, 1, 2:5, type = "databar") # For instance, to apply to only part of the column

  2. Save workbook and open in Excel:

  saveWorkbook(wb, "test.xlsx", TRUE)
  shell("\"test.xlsx\"")

sessionInfo()

  • Version of openxlsx: 4.1.4
  • Version of R: version 3.6.1 (2019-07-05), R studio 1.3.1073

same +1

ycphs commented

Could you please create this also at ycphs/openxlsx?

I am maintaining the active fork of the package.