Spreadsheet set Column width to value of double

Posted by: Jose.Aguirre on 14 August 2023, 6:34 pm EST

  • Posted 14 August 2023, 6:34 pm EST - Updated 14 August 2023, 7:03 pm EST

    Hello,

    when I try to set the width (height) of the spreadsheet to some value, it sets only the integer part of the value, even if it is of type double:

    double GrapeCity.Windows.SpreadSheet.Data.Column.Width

    E.g.: Width = 135.666

    the result Width is 135

    How to set the double value properly? Even a pixel can not be half, so why a double…

  • Posted 15 August 2023, 6:56 pm EST

    Hi,

    We are unable to replicate this behavior at our end. Width/Height are type of Double. If we set Width/Height = 135.666, then the Height/Width will be 135.666 not 135.

    Please refer the sample for the same: WpfSpreadDemo.zip

    Best Regards,

    Nitin

  • Posted 15 August 2023, 9:33 pm EST

    Sorry, partially my mistake. But as also stated later, I meant:

    double GrapeCity.Windows.SpreadSheet.Data.Column.Width

    it means the width of the column

  • Posted 16 August 2023, 6:30 pm EST

    Hi,

    Apologize for the inconvenience. We have replicated this issue at our end. This seems like a bug. So, we have escalated it to the development team. Will get back to you once we have any update from them.[Internal Tracking Id - SPNET-32688]

    Bets Regards

    Nitin

  • Posted 20 August 2023, 4:31 pm EST

    Hi,

    As per the development team, The current behavior is by design. Because there’s an explicit cast in GetColumnWidth that truncates the width value.

    It’s unsafe to change this behavior directly. Because it will break other features. We can only add a new API to get the exact column width.

    We will let you know once the new API to fetch the exact column width will be added.

    Best Regards,

    Nitin

Need extra support?

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

Learn More

Forum Channels