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
** 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.
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.
Who is online
Users browsing this forum: Ccbot [Crawler] and 1 guest