Comma Separator not working for Edit cell type in spread control

Posted by: saravanan-10.s-10 on 29 December 2019, 6:43 pm EST

  • Posted 29 December 2019, 6:43 pm EST

    I am using Spread control in one of form in my windows application.Currently one column is defined as celltype.number and it is Amount field where we have amount values 11,500.00 as an example.Our requirement is to make the cell editable like excel cell(i.e If we type 1500 on the cell with values(11,500.00)it should replace 11,500.00 with 1,500.00 instead of appending 115001500.00

    So we have changed the property of cell type from Number to CelltypeEdit.
    Now we are able to edit like excel but comma separator is not displaying as expected.it is simply showing as 1500.00

    Can anyone please assist how to add comma separator in celltypeEdit column or is there any other way to make my cell editable?

  • Replied 29 December 2019, 9:33 pm EST

    have you tried setting .EditmodeReplace = true?
  • Replied 29 December 2019, 9:43 pm EST

    Hi,
    Thanks for your information.
    Yes .EditmodeReplace = true already.

  • Replied 29 December 2019, 11:54 pm EST

    If I set celltype (column or cell) to Number, decimalplaces = 2, Separator to whatever character you want and ShowSeparator = true all works fine for me.

    Thomas
  • Replied 30 December 2019, 12:15 am EST

    Hi Thomas,

    Its working for me also,But we cant replace the existing values.
    Currently one column is defined as celltype.number and it is Amount field where we have amount values 11,500.00 as an example.Our requirement is to make the cell editable like excel cell(i.e If we type 1500 on the cell with values(11,500.00)it should replace 11,500.00 with 1,500.00 instead of appending 115001500.00
  • Replied 30 December 2019, 5:38 pm EST

    Hi,

    You can try using GeneralCellType with NumberFormat. Following is the code I used that replaces the previous value as well as comma separator is displaying well.
    fpSpread1.ActiveSheet.Cells[5, 0].Value = 11500;

    GeneralCellType numType = new GeneralCellType();

    System.Globalization.NumberFormatInfo numform = (System.Globalization.NumberFormatInfo)System.Globalization.NumberFormatInfo.CurrentInfo.Clone();
    numform.NumberDecimalDigits = 2;
    numform.NumberDecimalSeparator = ".";

    numType.NumberFormat = numform;

    fpSpread1.EditModeReplace = true;
    fpSpread1.ActiveSheet.Columns[0].CellType = numType;
    Thanks & Regards,
    Ruchir
  • Replied 6 January 2020, 9:38 pm EST

    Thank you for the Suggestion.

    I have tried the above method in my code ,comma separator is working as expected.It is working only for first row but not for the rest of the rows.Also if i enter some values in second row and changed values in first row ,values are not getting replaced instead it is appending with existing values,

    Could you please suggest any other solutions?
  • Marked as Answer

    Replied 7 January 2020, 9:50 pm EST

    Hello,

    The suggestion seems to be working as expected for me. See attached video.So, could you please share your code/application as there could be some statements that might be modifying the behavior.
    Also, what Spread version are you using?

    Thanks,
    Ruchir
  • Replied 9 January 2020, 9:59 pm EST

    Thank you for the suggestions.
    I am getting error in the below code while assigning cell type to the spreadcontrol.
    fpSpread1.ActiveSheet.Columns[0].CellType = numType;
    Error:
    Cannot implicitly convert type 'FarPoint.Win.Spread.CellType.GeneralCellType' to 'Gizmox.FarPointWin.SpreadEx.CellTypeConstants'
    Spread Version used:
    8.35.20143.0
    Since it is client application we cannot share the exact code in Forum.
    Note:
    We are using three columns in Spread and also we use only TAB key to move over the spreads.
  • Replied 12 January 2020, 7:29 pm EST

    Hi,

    The error you observe is a conversion error. From the error message, it seems that the first grid column is of a custom type 'Gizmox.FarPointWin.SpreadEx.CellTypeConstants' and hence, the exception is thrown. Have you assigned the above cell type to the column somewhere in the application?
    Also, are you using Spread 8 COM (Active X) controls in your application as the 'CellTypeConstants' was an enumeration in our COM components?

    >Since it is client application we cannot share the exact code in Forum.
    I understand. In that case, you may share the complete code/application with us through our SupportOne portal: https://supportone.componentone.com/newcase

    ~Ruchir
Need extra support?

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

Learn More

Forum Channels