NumberCellType DecimalPlaces honored for display but still rounds to 2 places

Posted by: davewill-fp on 8 September 2017, 3:04 pm EST

  • Posted 8 September 2017, 3:04 pm EST

    We are seeing NumberCellType columns that are set to DecimalPlaces of 4 display a value of 0.0591000000 as 0.0600.

    why?

    I'm not sure what to look for.

    We are doing the following to set the column to 4 decimal places

            Dim nc4 As FarPoint.Win.Spread.CellType.NumberCellType = New FarPoint.Win.Spread.CellType.NumberCellType
            nc4.DecimalPlaces = 4
            nc4.SetCurrentCulture(System.Globalization.CultureInfo.CurrentCulture)  'culture setting must occur after any customization of celltype
            With sheet
              .Columns(columnIndex).CellType = nc4
            End With
     
  • Replied 8 September 2017, 3:04 pm EST

    Hello,

    This seems to be a bug to me. Hence, we have escalated your issue to the concerned team for the fix and we will update you once it will be fixed.

    Thanks

    Reeva

  • Replied 8 September 2017, 3:04 pm EST

    Hello,

    We tested it with the latest build of Spread 6.0.3506.2008 and we aren't able to replicate it. Please have a look at the sample attached for that matter.

    Could you please specify which build are you using at your end?

    Thanks,

    Reeva

  • Replied 8 September 2017, 3:04 pm EST

    Hello,

    I am not too sure what are you looking for? Do you want the NumberCellType not to roundoff the value 0.059100000 as 0.600 and rather show it as 0.0591 then it is against the design behavior because numbers are always rounded off to there nearest decimal values.

    Could you please explain your exact requirement in detail again so that we can proceed further on this.

    Thanks,

    Reeva

  • Replied 8 September 2017, 3:04 pm EST

    We are configuring the column for 4 decimal places so we would expect the display in the cell to round to the number of places being shown.  In this case 4.  So a value of .059100000 needs no rounding at 4 decimal places.  It would show as 0.0591.  What we are seeing though is a display of 0.0600.

    If the value was .059190000 then we would expect it to round for display as 0.0592.

    Does that help explain what we are seeing?

  • Replied 8 September 2017, 3:05 pm EST

    We are using 5.0.3522.2008.
  • Replied 8 September 2017, 3:05 pm EST

    Hello,

    Yes, it was bug in older build which has been fixed now. Hence, I would request you to use the latest build  6.0.3506.2008 given below.

    http://www.componentone.com/Downloads/Download/?productID=537

    Thanks,

    Reeva

  • Replied 8 September 2017, 3:05 pm EST

    Reeva,

     We have migrated our solution to 6.0.3506.2008 and are still seeing the same behavior as V5.  In doing some more investigation we found that the order of operations matters for SetCurrentCulture.  There was a specific code comment put in to place for some other prior order of operations issue (possibly for another cell type) where SetCurrentCulture was recommended to be set after customizing the cell type.  In the case of the NumberCellType if the SetCurrentCulture is called before setting the decimalplaces property then it works as expected.

    Curiously, when decimal places is set to 0 the order of operations doesn't matter.

    There isn't much to go on in the help file for EditBaseCellType nor NumberCellType in regards to SetCurrentCulture.  Can we get some more information on SetCurrentCulture so we can understand if NumberCellType and other cell types need to be re-evaluated for order of operations in this regard?

Need extra support?

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

Learn More

Forum Channels