Hello,
When adding conditional formats, borders are not saved. I've browsed the source code, but due to my lack of familiarity with the code, I am unable to determine where the border information is being lost along the way.
Here is my code for creating a file with a conditional format intended to have a border:
```
Dim workbook = New ClosedXML.Excel.XLWorkbook()
Dim worksheet = workbook.AddWorksheet("Test")
worksheet.Cell(2, 2).SetValue("Text")
worksheet.Cell(2, 2).
AddConditionalFormat().WhenNotBlank.
Border.SetOutsideBorder(ClosedXML.Excel.XLBorderStyleValues.Thick).
Border.SetOutsideBorderColor(ClosedXML.Excel.XLColor.Blue)
workbook.SaveAs("C:\test.xslx")
```
The expected result is that cell B2 will have a blue border, because the cell value is "Test", and a blue border is the conditional format when the cell is not blank. (This result is possible is created manually in Excel 2010.)
The actual result is there is no border.
When renaming the saved XLSX to have a .zip extension, then viewing the styles.xml file, I find it the border portion is not included.
The expected XML in styles.xml is:
```
<x:dxfs count="1">
<x:dxf>
<x:border>
<x:left style="thin"><x:color auto="1" /></x:left>
<x:right style="thin"><x:color auto="1" /></x:right>
<x:top style="thin"><x:color auto="1" /></x:top>
<x:bottom style="thin"><x:color auto="1" /></x:bottom>
</x:border>
</x:dxf>
</x:dxfs>
```
The actual XML in styles.xml is:
```
<x:dxfs count="1">
<x:dxf>
<x:font />
<x:fill>
<x:patternFill />
</x:fill>
<x:border />
</x:dxf>
</x:dxfs>
```
Is this a bug in ClosedXML? Is there a way I can get this to work, or any specific area in the source code I may want to review to try and get borders to be supported in conditional formats?
Comments: Good catch. Pick up the latest source code.
When adding conditional formats, borders are not saved. I've browsed the source code, but due to my lack of familiarity with the code, I am unable to determine where the border information is being lost along the way.
Here is my code for creating a file with a conditional format intended to have a border:
```
Dim workbook = New ClosedXML.Excel.XLWorkbook()
Dim worksheet = workbook.AddWorksheet("Test")
worksheet.Cell(2, 2).SetValue("Text")
worksheet.Cell(2, 2).
AddConditionalFormat().WhenNotBlank.
Border.SetOutsideBorder(ClosedXML.Excel.XLBorderStyleValues.Thick).
Border.SetOutsideBorderColor(ClosedXML.Excel.XLColor.Blue)
workbook.SaveAs("C:\test.xslx")
```
The expected result is that cell B2 will have a blue border, because the cell value is "Test", and a blue border is the conditional format when the cell is not blank. (This result is possible is created manually in Excel 2010.)
The actual result is there is no border.
When renaming the saved XLSX to have a .zip extension, then viewing the styles.xml file, I find it the border portion is not included.
The expected XML in styles.xml is:
```
<x:dxfs count="1">
<x:dxf>
<x:border>
<x:left style="thin"><x:color auto="1" /></x:left>
<x:right style="thin"><x:color auto="1" /></x:right>
<x:top style="thin"><x:color auto="1" /></x:top>
<x:bottom style="thin"><x:color auto="1" /></x:bottom>
</x:border>
</x:dxf>
</x:dxfs>
```
The actual XML in styles.xml is:
```
<x:dxfs count="1">
<x:dxf>
<x:font />
<x:fill>
<x:patternFill />
</x:fill>
<x:border />
</x:dxf>
</x:dxfs>
```
Is this a bug in ClosedXML? Is there a way I can get this to work, or any specific area in the source code I may want to review to try and get borders to be supported in conditional formats?
Comments: Good catch. Pick up the latest source code.