decimalPlaces celltype

Posted by: supan on 8 September 2017, 5:21 am EST

  • Posted 8 September 2017, 5:21 am EST


      I use fpspread to display data from Access. I just wanna it displays the correct data format like the data itself ,such as '201006130954', '9.7534',but when it runs, there are something wrong , it can displays '201006130954' right, but '9.7534' was changed into '9.75', I didn't set celltype, they were default (none),because every seconds there new data was created, so I cannot set celltype dynamicly

    the following code to achieve these content<SPAN class=short_text id=result_box><SPAN style="COLOR:#000;BACKGROUND-COLOR:#e6ecf9;"><FONT size=5></FONT></SPAN></SPAN>

            Dim file1 As String = "select P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15from INPUTDATA1 order by id desc"
            Dim filestr1 As String = Nothing
            filestr1 = "d:\AutoTest\" & file
            Dim oleh As New SQLHelper.OleHelper(filestr1)
            Dim input1 As DataSet = oleh.QuerySet(file1)
            Me.FpSpread1_Sheet1.DataSource = input1


    so I wanna know why I didn't set celltype, the decimal data displays wrong, What I should do for it? just display like Text format.

    Thank you!


  • Replied 8 September 2017, 5:21 am EST

    Hello Supan,

    By default Spread's cell type is GeneralCellType and it takes number formatting from the regional settings of your system which could have been set to two in your system. Hence, you need to assign GeneralCellType having NumberDecimalDigits set to 4 and then assign it as the cell type of that particular column. Or you can assign a NumberCellType to that Column with DecimalPlaces set to 4.


                FarPoint.Win.Spread.CellType.GeneralCellType gct = new FarPoint.Win.Spread.CellType.GeneralCellType();
                System.Globalization.NumberFormatInfo numform = (System.Globalization.NumberFormatInfo)System.Globalization.NumberFormatInfo.CurrentInfo.Clone();
                numform.NumberDecimalDigits = 4;
                gct.NumberFormat = numform;
                fpSpread1.ActiveSheet.Columns[0].CellType = gct;


    Hope this will help you. Thanks.

  • Replied 8 September 2017, 5:21 am EST

    Hello Dhingra,

            Thank you for your help, I did this as your advice and what I got is what I want.



Need extra support?

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

Learn More

Forum Channels