Prevent Tags moving with cut anp paste or drag drop

Posted by: tony-j on 8 September 2017, 2:42 pm EST

  • Posted 8 September 2017, 2:42 pm EST


    I wanted to use cell tags to "mark" cells in a spread sheet with an id that uniquely identifies where the data belongs when saved, the problem I have is that when data is copied around using cut and paste or drag drop the tags move with the data, and when multiple cells are copied the column tag gets assigned to the target cells. The spread is not bound to a database.

     Is there any way to prevent tags moving during drag drop or copy paste?


  • Replied 8 September 2017, 2:42 pm EST

    Hello Tony,

    1. In case of cut and paste of cells using keyboard, you can prevent the moving of tag along with the cell by setting the ClipBoardPasteOptions enum value in ClipboardPaste method. This enum has different values which specify what all you would like to paste like only data, formatting, formulas and many more. The code for doing the same is:


    2. <span id=":1mm">I
    don't see a direct way to do this as this is the default behavior to
    move the data associated with the cell during drag drop. As a work
    around you would have to write code in Spread's DragDropBlock and
    DragDropCompleted events. In drag and drop operation, DragDropBlock which is fired when we start dragging and the DragDropCompleted
    which is fired when the operation is completed. In DragDropBlock event
    you should save the tag value of both the cells, that is the cell which
    is dragged and the cell onto which it is to be dropped,into two
    different global variables. And now reset the tag of the cell that is
    dragged to be null. In the DragDropCompleted event reset the tag values of both the cells using the global variables.</span>

    <div id=":1eq" class="kd"> Thanks,</div>

    Manpreet Kaur.



Need extra support?

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

Learn More

Forum Channels