Before Paste Event

Posted by: paul on 30 November 2017, 2:19 am EST

    • Post Options:
    • Link

    Posted 30 November 2017, 2:19 am EST

    I am running into an issue when I am trying to paste more rows on a sheet than the number of rows available. For example I am trying to paste 500 rows of data on a sheet that has only 200 rows. I know that before the paste can occur, the size of the pasted data is compared to the size of the sheet and if the data will not fit on the sheet the paste is cancelled, and I can see the error using the InvalidOperation Event. My question is if there is a way to perform my own data validation before any pasting occurs. Then if the sheet doesn’t have enough rows to hold the data, I will add rows to the sheet before continuing with the paste event.

  • Posted 3 December 2017, 8:55 pm EST

    Hello,

    It looks you want to increase the number of rows/columns as per the copied range.

    If the copied range contains more number of rows or columns than the target range and the target range is close to the edge, by setting “allowExtendPasteRange” we can allow extending the number of rows and columns automatically.

    
    spread.options.allowExtendPasteRange = true;
    
    

    Thanks,

    Deepak Sharma

  • Posted 17 March 2019, 8:15 pm EST

    Can we discard rest of 300 rows out of 500 as original row count is 200 only?

  • Posted 18 March 2019, 4:30 pm EST

    Hi Pooja,

    With setting the allowExtendPasteRange to false you only allow pasting the rows which are there in Spread.Sheets. It will not extend the range automatically on pasting more rows.

    spread.options.allowExtendPasteRange = false;

    Thanks,

    Deepak Sharma

Need extra support?

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

Learn More

Forum Channels