Author Topic: Pasting Data From Excel  (Read 2177 times)

DotNetRocks

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 7
    • View Profile
Pasting Data From Excel
« on: August 31, 2017, 06:01:12 pm »
We have a grid that we want to allow users to paste from an excel document. The pasting works great with one minor setback. if the user does not have a row selected and they paste, the pasted data will overlay the first X rows (X being how ever many rows they have copied). If they have a row selected and paste, it will overwrite the row they have selected and the rows below.

I would like to make it so the pasted data gets pasted into new rows, Is that possible?

Thanks!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pasting Data From Excel
« Reply #1 on: August 31, 2017, 10:20:31 pm »
pasteModel.type = 'append' or 'prepend' can be used for it.

https://paramquery.com/pro/api#option-pasteModel

DotNetRocks

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Pasting Data From Excel
« Reply #2 on: September 06, 2017, 01:40:58 am »
Thank you! that solved this issue.

However, I have two other questions for you with pasting from Excel.

1. Is it possible to make all pasted rows go to the end of the grid rather than the current behavior?

2. I have two columns that are hidden which are at the end of the column model, if I pasted data from Excel sometimes these hidden columns get values set to them even though they should not. What is causing this?

Thanks!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pasting Data From Excel
« Reply #3 on: September 06, 2017, 11:40:15 pm »
1. I don't see any declarative option for it. It could be done however by implementing beforeValidate event and converting ui.updateList into ui.addList when ui.source == 'paste' inside the event.

2. It could be caused when pasted data has more columns of data than the selected range at the right edge of columns.