Cell state issues

Posted by: ryan on 17 September 2021, 1:22 pm EST

    • Post Options:
    • Link

    Posted 17 September 2021, 1:22 pm EST - Updated 3 October 2022, 9:38 am EST

    https://www.loom.com/share/acb498c0666a4a1886f6a445b3d3a060

    Hi how do I set some sort of priority to achieve the following:

    if data is entered in a cell, I want the text to be green and there to be no border

    if no data is entered into the cell, I want the border to be green.

    The current implementation is not correct because i would expect the left border on February, June, and Sept to been green

  • Posted 20 September 2021, 4:36 am EST

    Hi Ryan,

    You may use conditional formatting for the required functionality. Please refer to the following code snippet and attached sample that demonstrates the same.

    
    var style = new GC.Spread.Sheets.Style();
      style.foreColor = "green";
      var blankStyle = new GC.Spread.Sheets.Style();
      blankStyle.borderLeft = new GC.Spread.Sheets.LineBorder(
        "green",
        GC.Spread.Sheets.LineStyle.thin
      );
      blankStyle.borderTop = new GC.Spread.Sheets.LineBorder(
        "green",
        GC.Spread.Sheets.LineStyle.thin
      );
      blankStyle.borderBottom = new GC.Spread.Sheets.LineBorder(
        "green",
        GC.Spread.Sheets.LineStyle.thin
      );
      blankStyle.borderRight = new GC.Spread.Sheets.LineBorder(
        "green",
        GC.Spread.Sheets.LineStyle.thin
      );
      var ranges = [new GC.Spread.Sheets.Range(1, 1, 4, 3)];
       /* for non blank values*/
      sheet.conditionalFormats.addFormulaRule("Not(ISBlank(B2))", style, ranges);
      /*for blank values*/
      sheet.conditionalFormats.addFormulaRule("IsBlank(B2)", blankStyle, ranges);
    
    

    sample: https://codesandbox.io/s/spread-js-starter-forked-ftw8u?file=/src/index.js:227-1013

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels