Hi Friends,
As understood from the subject I would like to select the specific portion of excel and paste into Gupta table or grid. Is this possible?
Regards
Mehmet Civisilli
Copy from excel and paste into grid or table
Re: Copy from excel and paste into grid or table
I thought I would wait to see if anyone had a full solution to your question, Mehmet, but no one replied.
There is a possible way to copy the entire XLS data -- saved in XML format -- to a TD using SalTblPopulateFromXML() but I didn't do this. You had asked for a copy/paste method of rows from XL, so let me show a way using the 3 files in the zip:
1 - 2 rows of xls data
2 - test TD in v6.3 and I back-converted it to v5.2 as well.
... Per your question, I have a way
1) Have some data in Excel or a work-alike appl. that you want to paste into a TW
2) Select the data and click Ctrl+C.
I have attached PNGs that show, top to bottom:
> the XLS data
> TD test with details of the tokenized string array of data from the field
> what the ML field and TW data look like
now from the TD test click the button which:
3) pastes the data -- for demo purposes -- into a visible ML field. (Normally, this would be invisible)
4) code then parses the data in the ML field and fills the child TW with the 2 rows of data. I added a string, 2 numbers and a datetime
NOTES:
** The assumption is that the XLS has 4 columns and that the TW has 4 matching hard-coded columns in terms of the datatypes.
** I see you must select a blank cell to the right of each cell. See the #2 PNG below to show how to do this with the sample data.
** IF YOU DO NOT select that extra blank to the right of each row, then the data paste and show correctly in the ML field BUT see the Locals window to the left of TD and where my cursor is pointing -- if there's no blank cell at end of row 1, then 2 columns' values get concatenated and paste incorrectly into the TW, as shown in attached #1 PNG.
** The code does NOT work if the user selects only certain columns from the XLS data. S/he must select entire row(s) + a blank cell at the end of each row. in the spreadsheet.
Consider this test a "Proof of Concept" appl. only. Additions to the code might include error handling of the data, dynamically creating TW columns given a single row (now to title the columns?), etc.
There is a possible way to copy the entire XLS data -- saved in XML format -- to a TD using SalTblPopulateFromXML() but I didn't do this. You had asked for a copy/paste method of rows from XL, so let me show a way using the 3 files in the zip:
1 - 2 rows of xls data
2 - test TD in v6.3 and I back-converted it to v5.2 as well.
... Per your question, I have a way
that involves a kind of workaround. Briefly, here is how:to select the specific portion of excel and paste into Gupta table or grid
1) Have some data in Excel or a work-alike appl. that you want to paste into a TW
2) Select the data and click Ctrl+C.
I have attached PNGs that show, top to bottom:
> the XLS data
> TD test with details of the tokenized string array of data from the field
> what the ML field and TW data look like
now from the TD test click the button which:
3) pastes the data -- for demo purposes -- into a visible ML field. (Normally, this would be invisible)
4) code then parses the data in the ML field and fills the child TW with the 2 rows of data. I added a string, 2 numbers and a datetime
NOTES:
** The assumption is that the XLS has 4 columns and that the TW has 4 matching hard-coded columns in terms of the datatypes.
** I see you must select a blank cell to the right of each cell. See the #2 PNG below to show how to do this with the sample data.
** IF YOU DO NOT select that extra blank to the right of each row, then the data paste and show correctly in the ML field BUT see the Locals window to the left of TD and where my cursor is pointing -- if there's no blank cell at end of row 1, then 2 columns' values get concatenated and paste incorrectly into the TW, as shown in attached #1 PNG.
** The code does NOT work if the user selects only certain columns from the XLS data. S/he must select entire row(s) + a blank cell at the end of each row. in the spreadsheet.
Consider this test a "Proof of Concept" appl. only. Additions to the code might include error handling of the data, dynamically creating TW columns given a single row (now to title the columns?), etc.
You do not have the required permissions to view the files attached to this post.
Jeff Luther @ PC Design
Palm Springs, California
Palm Springs, California
Re: Copy from excel and paste into grid or table
Dear Jeff,
Thank you very much for the solution with an example.
Thank you very much for the solution with an example.
Re: Copy from excel and paste into grid or table
You are welcome. I hope it will help you.
Jeff Luther @ PC Design
Palm Springs, California
Palm Springs, California
Re: Copy from excel and paste into grid or table
Hi Jeff,
While I was working on your example, I come across with a Sal function which does the job a lot more easier. 'SalTblPasteRows'
The important thing here is the number of columns must match. The table columns in the grid with excel columns.
I thought you will find it helpful.
Mehmet
While I was working on your example, I come across with a Sal function which does the job a lot more easier. 'SalTblPasteRows'
The important thing here is the number of columns must match. The table columns in the grid with excel columns.
I thought you will find it helpful.
Mehmet
Re: Copy from excel and paste into grid or table
Thanks. I believe I saw that when I was coding the sample but saw the Date column value didn't paste literally from the Excel spreadsheet into the table window. But if this is not an issue, then SalTblPasteRows() does work.
Jeff Luther @ PC Design
Palm Springs, California
Palm Springs, California
Who is online
Users browsing this forum: [Ccbot] and 0 guests