Change of color after I paste the copied range

  • Purna Chandra Rao 2 years, 6 months ago

    Hi

    I am very new to the FP Spreed.

    I open my Excel file using the FPSpreed. After opening , the Spreed is as expected, with all the Locked cells and unlocked cells and back colors etc..

    Wen i try try to paste some values in the unlocked cells , the back color is also changing. I dont want to change the back color.

    Please advice?

    thanks for your help in advance.

  • 105p
    Reeva105p 2 years, 6 months ago

    Hello,

    You can set the ClipboardPasteOptions to ‘Values’ for the same as given below:-

    ContextMenu cm = new ContextMenu();
    private void Form1_Load_1(object sender, EventArgs e)
    {
        MenuItem paste = new MenuItem("paste");
        paste.Click += new EventHandler(paste_Click);
        cm.MenuItems.Add(paste);
        MenuItem copy = new MenuItem("copy");
        copy.Click += new EventHandler(copy_Click);
        cm.MenuItems.Add(copy);
        fpSpread2.ContextMenu = cm;
        fpSpread2_Sheet1.Cells[2, 2].BackColor = Color.Red;
    }
    void paste_Click(object sender, EventArgs e)
    {
        fpSpread2.ActiveSheet.ClipboardPaste(FarPoint.Win.Spread.ClipboardPasteOptions.Values);
    }
    void copy_Click(object sender, EventArgs e)
    {
        fpSpread2.ActiveSheet.ClipboardCopy(FarPoint.Win.Spread.ClipboardCopyOptions.Values);
    }

    Hope it helps.

    Thanks,
    Reeva

  • Purna Chandra Rao 2 years, 6 months ago

    Hi Reeva,

    Thanks for your code.

    Above code is working if I paste the data from other Excel sheet to this Spreed.

    Its not working if I copy from the same Spreed .

    Regards,
    Purna.

  • 105p
    Reeva105p 2 years, 6 months ago

    Hello,

    It works within the spread control as well but when you write this code on button click event or on ContextMenuItem click event.

    Hope it clarifies.

    Thanks,
    Reeva

  • Purna Chandra Rao 2 years, 6 months ago

    Thanks it works.

  • evano2l 5 months, 2 weeks ago

    I am able to capture the pasting event in my grid’s base class, but only for the case where the user selects “Paste” from the context menu. I can’t figure out how to add this to the the keyboard shortcut (Ctrl+V). I would like for all grids using this base class to paste only values.

  • 122p
    Sean Lawyer122p 5 months, 2 weeks ago

    Hi,

    Clipboard shortcut keys are mapped to clipboard actions in the input map. You can change the clipboard action for Ctrl+V using the input map API to set the ClipboardPasteValues action, or you can set the None action and handle the key in other code, where you can have more control over the paste (e.g. a menu command) using the ClipboardPaste method with ClipboardPasteOptions.Values.

    Regards,
    -Sean

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to create new topics.