Cell Types

Posted by: john-shugart on 8 September 2017, 2:05 pm EST

  • Posted 8 September 2017, 2:05 pm EST

    I have a spread that has a datasource of a RowFilter, when I change the datasouce it appears as though the cell type is being reset. I say this because my comma's dissapear when I change the RowFilter.


    I've set a breakpoint and the cell type is still intact, but the ShowSeparator isn't showing. How can I maintain the separators when changing the RowFilter?


    Thanks in advance,


    John

  • Replied 8 September 2017, 2:05 pm EST

    Hello,


    My experience has been that changing things pertaining to the DataSource tend to reset CellTypes. As a work-around, this is what I do:


    VB.Net


    ' In form load code or other initialization code.
    Dim list As Dictionary(Of Integer, ICellType)
    For Each column As Column In Me.FpSpread1.Sheets(0).Columns
        list.Add(column.Index, column.CellType)
    Next


    ' After resetting DataSource or changing RowFilter.
    For Each column As Column In Me.FpSpread1.Sheets(0).Columns
        column.CellType = list.Item(column.Index)
    Next


    C#


    // In form load code or other initialization code.


    {
        Dictionary list = default(Dictionary);
        foreach (Column column in this.FpSpread1.Sheets(0).Columns) {
            list.Add(column.Index, column.CellType);
        }
       
        // After resetting DataSource or changing RowFilter.
        foreach (Column column in this.FpSpread1.Sheets(0).Columns) {
            column.CellType = list.Item(column.Index);
        }
    }


     



     

  • Replied 8 September 2017, 2:05 pm EST

    Hello John,


     


    Can you please attach a small sample so that we can check this issue further at our end?


     


    Also let us know the version of Spread for Windows Forms installed on your machine.


     


    Regards,


    Amit

  • Replied 8 September 2017, 2:05 pm EST

    John,


    You can set the DataAutoCellTypes property to False to keep Spread from defaulting the CellTypes for the columns to the type it thinks best based on bound DataColumn.

Need extra support?

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

Learn More

Forum Channels