'Setting style in cells with conditional formatting in ClosedXML C#

There was a need to make conditional formatting of a cell with a histogram. Used ClosedXML but it didn't give the desired result.

enter image description here

It is necessary to solve the problem with both the gradient and negative numbers. Has anyone encountered something similar? I am attaching the code.

form_sheet.Cell("D37")
   .AddConditionalFormat()
   .DataBar(XLColor.FromArgb(68, 114, 196), false)
      .Minimum(XLCFContentType.Number, -3)
      .Maximum(XLCFContentType.Number, 3);

Ready to consider alternative solutions not through ClosedXML. The program will generate several dozen reports. All histograms will be in the same cells, so I also considered vbs, but I don’t have enough experience to write such a script that would change styles immediately for a bunch of documents.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source