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

Problem with the conditional formatting #61

Closed
stanislav-ss opened this issue Oct 7, 2016 · 6 comments
Closed

Problem with the conditional formatting #61

stanislav-ss opened this issue Oct 7, 2016 · 6 comments

Comments

@stanislav-ss
Copy link

stanislav-ss commented Oct 7, 2016

Hi.
I have a problem with the conditional formatting and Excel 2013. Reprosteps:

  • Create a new .xlsx file using Excel 2013.
  • Add to the first cell some number and then apply to this cell conditional formatting, for example color scales.
  • Save this file.
  • Then I open this file using ClosedXML and save it without any changes. When I try to open this file using Excel 2013 I will get an error:
    “Excel found unreadable content in 'FILENAME.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.”

If I don’t apply conditional formatting to that cell, I won’t get an error after resaving file using ClosedXML.
Any suggestions?

PS: I validated the content of resaved .xlsx file using OpenXmlValidator.Validate() method and got this error:
screenshot_1

PPS: ConditionalFormatting node when file saved using Excel:
<x:conditionalFormatting xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" sqref="A1:C1"> <x:cfRule type="colorScale" priority="1"> <x:colorScale> <x:cfvo type="min" /> <x:cfvo type="max" /> <x:color rgb="FFFF7128" /> <x:color rgb="FFFFEF9C" /> </x:colorScale> </x:cfRule> </x:conditionalFormatting>

ConditionalFormatting node when file resaved using ClosedXML:
<x:conditionalFormatting xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" sqref="A1:C1"> <x:cfRule type="colorScale" priority="1"> <x:colorScale /> </x:cfRule> </x:conditionalFormatting>

@igitur
Copy link
Member

igitur commented Oct 10, 2016

I tried your steps and I can't reproduce it exactly. I end up with a workbook that Excel can open without problems and no messages of unreadable content. However, the conditional formatting is partially lost.

Which versions of Excel and ClosedXML are you using?

@stanislav-ss
Copy link
Author

I am using ClosedXML of version 0.80.1 and Excel 2013.

@igitur
Copy link
Member

igitur commented Oct 10, 2016

Please attach the Excel file that you open with ClosedXML. Maybe the conditional formatting rules that I chose are a bit different.

@stanislav-ss
Copy link
Author

original.xlsx

@igitur
Copy link
Member

igitur commented Oct 10, 2016

Thanks. now I get the unreadable content error message. Will investigate.

@stanislav-ss
Copy link
Author

Thanks a lot!

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