CheckboxCellType return default value.

Posted by: silkkeng-fp on 8 September 2017, 1:47 pm EST

  • Posted 8 September 2017, 1:47 pm EST

    Hi Scott or Bob,

    We have a column which is CheckBoxCellType and will show a Tick image if is True, cross image if it is False.

    However, for some rows in this column, there are actually no data. The value is Nothing. But, it is still showing False image. We want those when value is nothing, it return no image at all.

    As I understand that False is a default values, so we are thinking of using Indeterminate state. When value is Nothing, set the state to Indeterminate.

    See attached file for print screen.

    We have create class to try to achieve, but fail to do so.

    <font size="1"> Imports FarPoint.Win.Spread.CellType

    Public Class ReportBooleanStyleCellType
        Inherits CheckBoxCellType

        Public Sub New(ByVal showTrueImage As Boolean, ByVal showFalseImage As Boolean)
            If showTrueImage Then
                Me.Picture.TrueDisabled = InvestmentManager.Images.ReportTrue
                Me.Picture.TrueDisabled = InvestmentManager.Images.ReportEmpty
            End If
            If showFalseImage Then
                Me.Picture.FalseDisabled = InvestmentManager.Images.ReportFalse
                Me.Picture.FalseDisabled = InvestmentManager.Images.ReportEmpty
            End If
        End Sub

        Public Overrides Sub PaintCell(ByVal g As System.Drawing.Graphics, ByVal r As System.Drawing.Rectangle, ByVal appearance As FarPoint.Win.Spread.Appearance, ByVal value As Object, ByVal isSelected As Boolean, ByVal isLocked As Boolean, ByVal zoomFactor As Single)
            If value IsNot Nothing AndAlso TypeOf value Is Boolean Then
                MyBase.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor)
            End If
        End Sub
    End Class


    It works find on the spread view, and export to PDF, export to CSV.

    But, when we export the spread to Excel, the column in Excel
    will have those Value=Nothing row replaced with False instead of showing

    Is there a way to achieve this?

    Means, when Cell.Value is True or False, it set the True/False image. When Cell.Value is Nothing, it dont show image and the Value is still Nothing when export to Excel.

     Thank you




  • Replied 8 September 2017, 1:47 pm EST


    If you have not set a value to the cell, then it should not write out a False to Excel. It is not doing this in my tests. Make sure you have the latest maintenance release. If it is still having issues with the latest release, could you post a small zipped project reproducing this issue for us to debug?

Need extra support?

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

Learn More

Forum Channels