Selection Problem

Posted by: vkempanna on 8 September 2017, 12:41 pm EST

  • Posted 8 September 2017, 12:41 pm EST

    I have a spread with selection Block options set to Cells,Rows,Columns  and selection unit set to cell.


    Each time the user makes selection i am trying to get the range of selected columns and rows using

    <FONT size=2>

    fpSpread_Sheet1.Models.Selection.This works fine in all case.But when i click on the column header ,


    the fpSpread_Sheet1.Models.Selection.AnchorRow and  fpSpread_Sheet1.Models.Selection.LeadRow returns 0,


    Whats is the problem?


     

    </FONT>
  • Replied 8 September 2017, 12:41 pm EST

    Vinutha -

    That is the expected behavior.  The column and row headers are their own classes and not part of the sheets selection model and would not be returned when querying those selection properties.
  • Replied 8 September 2017, 12:41 pm EST

    So how would i get the Rows selected when the  user clicks on the column header?
  • Replied 8 September 2017, 12:41 pm EST

    Vinutha -

    When you click on a column header all the rows will be selected so you have a couple options.  In the CellClick event you can check to see if you are clicking on a header and just return the row count for the sheet.  Or you can use a cellrange object to return the selection and if the Row and RowCount return -1 then you know all the rows are selected...

    Dim cr As FarPoint.Win.Spread.Model.CellRange
    cr = FpSpread1.ActiveSheet.GetSelection(0)
    MsgBox(cr.Row & "  " & cr.Column & "  " & cr.RowCount & "  " & cr.ColumnCount)
Need extra support?

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

Learn More

Forum Channels