Not able to enter any values after Setting Regular Expression CellType

Posted by: sg on 8 September 2017, 12:38 pm EST

  • Posted 8 September 2017, 12:38 pm EST

       Hello,


    I am using latest version of Spread (v.2.5.2011.2005) and decided to try Regular Expression CellType instead of handling entries on the LeaveCell event. However when I assign this cell type to the column or to the range of cells [I tried it via setting CellType in Spread Designer or via code] I am not able to type in any values into the cell. Any idea?


    Here is sample code:


    FarPoint.Win.Spread.CellType.RegularExpressionCellType regexcell = new FarPoint.Win.Spread.CellType.RegularExpressionCellType();


    regexcell.RegularExpression = "^(\\d{6}[\\-])*(\\d{6};)*(\\d{6};?)$";


    this.sprBooking.ActiveSheet.Columns[9].CellType = regexcell;


    this.sprBooking.ActiveSheet.Cells[0, 9, sprBooking.ActiveSheet.Rows.Count - 1, 9].CellType = regexcell;//just in case column's celltype doesn't take...

  • Replied 8 September 2017, 12:38 pm EST

    sg -

    I'm not that familiar with regular expressions, so I'm not sure what yours is supposed to allow the user to type, but nonetheless I was still able to type into the cell.  Of course, not knowing what would match the value I typed in, the text disappeared when I clicked off the cell.  But I was able to type into the cell.  Here's some code I used for another test where I knew what to type in...

    Dim regexcell As New FarPoint.Win.Spread.CellType.RegularExpressionCellType()

    regexcell.RegularExpression = "[0-9]{3}-[0-9]{2}-[0-9]{4}"

    FpSpread2.ActiveSheet.Columns(0).CellType = regexcell

    If you can give me an example of what would be an appropriate string to type in the cell I will test it again with your regular expression to see if that is the issue.
  • Replied 8 September 2017, 12:38 pm EST

    Bob,


    I am not worried about regular expression itself. It's a correct one. It should let only this kind of input:


    200703-200710;200705 or simply several codes with no range like this: 200701;200702;200704


    Anyway, I changed my code to use your regular expression to enter SS# and it still not working.


    I've tried to change my initial settings in Spread designer to have column with index #9 to be set as Text or as General data type and then in code set CellType to Reg. Expression but with no luck.


    I saved my spread in xml file and attached it to this thread. Would you please let me know what is wrong with it?


    2007/06/spreadRegExpColumn.zip
  • Replied 8 September 2017, 12:38 pm EST

    Hello,


    I tested your sample XML file and saw you set up a column with a SS# regulat expression. I loaded the XML file into Spread and I was able to type social security numbers into the cell with no problem and the number did not go away when I left the cell. Could you give us an example of some text you tried to type in the cell? Were you not able to type the data in the cell or did it type and just disappear when you exit editmode?

  • Replied 8 September 2017, 12:38 pm EST

    Scott,


    I found the problem. I had some code in EditChange event that was clearing values in the cell. It was not happening in the previous version though..


    Anyway, thanks for your help!


    Lana

Need extra support?

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

Learn More

Forum Channels