How do I programatically change the "Static" property of a cell?

Posted by: timko65 on 8 September 2017, 2:16 pm EST

  • Posted 8 September 2017, 2:16 pm EST

    I have a situation where I need to get at the the "Static" property for a cell to turn it on and off "on the fly" based on various scenarios. I can find many properties that are accessible but the static property seems to be very well hidden. Can you point me in the right direction on where I can find this property and ant "tricks" I might need to know for setting it on and off on the fly.  Thanks in advance.
  • Replied 8 September 2017, 2:16 pm EST

    Hello,


    Several editable cell types in FarPoint Spread inherit the EditBaseCellType. Hence you can try using the GetCellType() of the EditBaseCellType and then querying Static property of the same to turn it on and off on the fly. Code for the same is given below:



     FarPoint.Win.Spread.CellType.EditBaseCellType edt;
            private void Form1_Load(object sender, EventArgs e)
            {
                edt = new FarPoint.Win.Spread.CellType.EditBaseCellType();
                edt = (FarPoint.Win.Spread.CellType.EditBaseCellType)fpSpread1.ActiveSheet.GetCellType(fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex);
            }
            private void button1_Click(object sender, EventArgs e)
            {
                if (edt.Static == false)
                    fpSpread1.ActiveSheet.Cells[fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex].Locked = true;
            }


    Here, rather than changing the Static property of the EditBaseCellType to true we have used Locked property of cell because all editable CellTypes are inherited from EditBaseCellType and setting it to true will change the Static property of all the CellsTypes which are being inherited from EditBaseCellType.


    Hope it will help you.Thanks.

  • Replied 8 September 2017, 2:16 pm EST

    That worked great - Thanks much!!

Need extra support?

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

Learn More

Forum Channels