Paul Bussey
2014-11-20T15:27:39Z
I'm trying virtual mode of iGrid to populate it with data from an Excel spreadsheet.

When I paste rows from the spreadsheet that are more than the visible amount of rows on the iGrid, I get the message:-

"Not enough space to paste all data".

Is there a way I can get iGrid to accept the amount of rows that are being copied?
Igor/10Tec
2014-11-21T07:47:27Z
We have never thought about using virtual mode in this context. The iGrid virtual mode is used in the scenario when the user tries to scroll iGrid in the vertical direction, and new rows are requested on demand.

After examining the corresponding part of the source code I see that theoretically we can implement the requested functionality. However, it will require decent testing. If you are ready to work on this problem together with us, let's continue this dialog in email correspondence.

If we ever gain the goal, I'll return to this post and publish a report about our results here too.
Paul Bussey
2014-11-21T10:03:32Z
Thank you Igor for considering to implement this requested functionality.

My ultimate goal is giving our sales staff the ability to quickly transfer spreadsheet data from Excel into Microsoft Access and iGrid I believe could offer that possibility. From the sales staff point of view, copying and pasting columns of data at a time or alternatively dragging and dropping columns of data would be an advantage over trying to import a spreadsheet into an Access back end table. I think dragging and dropping columns from Excel into iGrid may be a harder solution, but I believe either solution would require the help of virtual mode I think, because of the unknown amount of rows brought in each time.

To give you some context, our company receives requests for quotations (of electronic components) in many forms; most of these arrive in the form of Excel spreadsheets. The number of items requested for quotation (rows) varies of course, but the data columns such as part number, amount, alternative part number, description may be shown in various orders and interspersed with columns that won't be used.

I'm not entirely sure whether virtual mode HAS to be used, since I imagine there may be a way to gain the amount of rows being copied and dynamically add them into the grid just before the paste takes place.

Hope this gives you a little more context of what I'm trying to achieve.

Paul

Igor/10Tec
2014-11-21T15:53:51Z
Yes, virtual mode could be used in the first scenario when your users paste copied data, but it is definitely not the choice for the second OLE drag-n-drop method of adding data from Excel. You really need to count the total number of data rows in the clipboard before adding data into iGrid and extend it dynamically if required.

The Excel clipboard data format is enough simple (if we talk about the text representation) - rows are separated with vbCrLf, cell values are separated with vbTab. You ordered iGrid and have the source code now, and you can see how we process such a clipboard string in the private pClipboardPasteFrom procedure in the iGrid main module.

As for the moment when you can calculate the number of rows to paste, for OLE drag-n-drop it's definitely OLEDragDrop. As for pasting from the clipboard, we have two methods. For the keyboard command CTRL+V it's the KeyDown event, and there should be no problems with that too. As for pasting using the mouse, it's the built-in context menu, and this is the hardest part of this puzzle as there is no related event you can use for your calculation. The only event raised during the process of pasting is RequestEdit; it is raised for every cell, but you can analyze whether it is raised for the current cell to do your calculations only once. If this approach won't work for some reasons, you can simply prohibit all built-in context menus using the BuiltinContextMenus property.
Paul Bussey
2014-11-24T10:13:03Z
Thanks for your response Igor.

It sounds like the CTRL+V option is easier to implement and test than the drag and drop method. It could be a useful addition to iGrid for other customers. Are you okay with adding this in to iGrid as a development- I would be happy to help test.
Igor/10Tec
2014-11-25T06:34:03Z
Ok, let's continue in email correspondence.
Igor/10Tec
2015-01-13T16:55:22Z
The suggested feature was implemented in the iGrid 5.0.105 released on Dec-11, 2014. Now it automatically adds new rows needed to accommodate all pasted data when virtual mode is on.