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

wb_load conditional formatting range bug #646

Closed
Michiel91 opened this issue Jun 12, 2023 · 5 comments
Closed

wb_load conditional formatting range bug #646

Michiel91 opened this issue Jun 12, 2023 · 5 comments

Comments

@Michiel91
Copy link

I ran into a bug when loading an existing Excel workbook with conditional formatting. The original range of the conditional formatting is incorrectly imported (and therefore also exported). It somehow seems that openxlsx2 appends increasing numbers to the range of the conditional formatting, erroneously modifying it.

Below is an example to reproduce this bug:

  1. Create a new workbook in Excel
  2. Fill A1:B5 with values 0, 1 and 2.
  3. Create new conditional formatting rules for A1:B5. For example bg fill #FFC000 for 0, #92D050 for 1 and #00B0F0 for 2.
  4. Load this workbook into R using openxlsx2::wb_load
  5. In worksheets[[1]]$conditionalFormatting the three conditional formatting ranges A1:B5 are modified to c('A1:B51', 'A1:B52', 'A1:B53')
  6. When exporting the workbook or working with it downstream the conditional formatting rules are now erroneously applied to A1:B51, A1:B52, etc.

Thanks in advance for looking into this unexpected behavior. Let me know if I can help by providing additional examples or information.

@JanMarvin
Copy link
Owner

Hi @Michiel91 , thanks for the report. I can reproduce the exact behavior with the following file:
cf.xlsx. I look into it.

@JanMarvin
Copy link
Owner

I've pushed a pull request in #647 . You could check if this solves your issue. I'll add a test and a NEWS entry later. Lunch break is ending :)

@JanMarvin
Copy link
Owner

apparently the fix broke something else. have to check later

@Michiel91
Copy link
Author

Thanks a lot for already looking into this so quickly! I'll wait for the final fix and will test it once available. Even dedicating your lunch break to fixing bugs is what they call dedication, I hope you still had lunch :).

@Michiel91
Copy link
Author

Thanks for the fix @JanMarvin, I just tested with the latest development version and can confirm this issue is now solved.

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

No branches or pull requests

2 participants