Urgent - How To Avoid Regional Number rounding in Numeric cell type

Posted by: sanketj on 8 September 2017, 2:18 pm EST

  • Posted 8 September 2017, 2:18 pm EST


    I have assign number celltype to my column. I have not set any decimal places for the column. I have only set comma separator for the same.

    Now One of my cell has value 14.123 and another is 12.45. I want that this value should be shown without any formatting of decimal. But farPoint is taking Regional setting formatting and format column values as per that.

    If i assign column to TextCellType then i would not able to apply comma separation for the same.

    Regional Setting value will be set on below path. 

     Control Panel --> Regional Language and Options --> Regional Options --> Customized --> No. of Digit after decimal

    I want to avoid this formatting. Any Propery of spread which will stop automatically formatting of numeric cells.

    E.g.  If Setting is 2 decimal below two values will be shown as 14.12 and 12.45 and if Setting is 4 digit then it will show as 14.1230 and 12.4500.


  • Replied 8 September 2017, 2:18 pm EST


    You may set the cell type to NumberCellType and set FixedPoint to False. Have a look at the following code snippet,

            Dim num As New FarPoint.Win.Spread.CellType.NumberCellType
            num.DecimalSeparator = ","
            num.FixedPoint = False
            num.DecimalPlaces = 4
            FpSpread1.ActiveSheet.Columns(1).CellType = num

    I hope it will help you.



  • Replied 8 September 2017, 2:18 pm EST

    Hi Deepak

    Thanks for reply.

    first of all i dont want to user DecimalPlaces as it will be different for all cells. And if i use FixPoint=False then It will make my number e.g. 12.000 to 12, which i dont want. I want to show data as it is whatever is coming from my program.

    e.g. if it is coming like 12.232 it should show 12.232, if it comes like 12.0000 it should sho 12.0000 not 12.

    Any other property, or culture setting which will avoid regional settings ?


  • Replied 8 September 2017, 2:18 pm EST


    On setting FixedPoint to false in NumberCellType, this is the default behaviour of NumberCellType to truncate decimal places if its zero.

    However, as a work around you can try using a RegularExpressionCellType wherein you can set RegularExpression such that it allows you to enter numbers only along with n number of decimal digits. Please have a look at the code below:


                FarPoint.Win.Spread.CellType.RegularExpressionCellType regex = new FarPoint.Win.Spread.CellType.RegularExpressionCellType();
                regex.RegularExpression = @"^(\d|,)*\.?\d*$";
                fpSpread1.ActiveSheet.Columns[0].CellType = regex;


     Hope this will help you. Thanks.



Need extra support?

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

Learn More

Forum Channels