Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Drag&Drop, Own Context Menu
posted

1. I want to insert a number from UltraWinGrid to a cell in UltraSpreadSheet by dragging and dropping with the mouse. Is this already possible?

2. Furthermore I would like to assign its own context menu for each cell. Is there a possibility for that?

3. Is it possible to select a cell by its address (e.g. A5)?


Thanks! 


Parents
No Data
Reply
  • 23930
    Offline posted

    Hi Uwe,

    Thank you for posting in our forums.

    Your first two queries are currently not possible in the Spreadsheet, so you can add a new product idea for them in our product ideas site. As for how to select a cell by a given address, you can use the following code (note that the address variable is the address of the cell, for example “AZ5”):

                var firstNumber = address.FirstOrDefault(c => Char.IsDigit(c));

                var indexOfNumber = address.IndexOf(firstNumber);

                var column = address.Substring(0, indexOfNumber);

                var row = address.Substring(indexOfNumber, address.Length - indexOfNumber);

                var columnIndex = ((column.Length - 1) * 26) + (char.ToUpper(column.Last()) - 64);

                var rowIndex = int.Parse(row);

                // The indexes are zero based so we need to decrement them.

                columnIndex--;

                rowIndex--;

                ultraSpreadsheet1.ActivePane.Selection.ClearCellRanges();

                ultraSpreadsheet1.ActivePane.Selection.SetActiveCell(new SpreadsheetCell(rowIndex, columnIndex));           ultraSpreadsheet1.ActivePane.ScrollCellIntoView(ultraSpreadsheet1.ActivePane.Selection.ActiveCell);

    Please let me know if you have any additional questions.

Children
No Data