Part1
i have prepare 1st Demo to show how to get a Excel Sheet using COM into Array and show it in GRID
it also include This.CellColIndex BUG which show Col+1
Array get from Excel are Column so we need to convert it to Row
Code: Select all
iMax := LEN( aExcel )
FOR i := 1 TO iMax
AADD( aHead, aExcel[ i ] [ 1 ] )
AADD( aWidths, aWide[ i ] * 10 ) // twips ...
NEXT
iMax := LEN( aExcel ) // Rows
jMax := LEN( aExcel[ 1 ] ) // Columns
j := 1
FOR j := 1 TO jMax // every Column
aLine := {}
i := 1
FOR i := 1 TO iMax // build Line
IF NIL = aExcel[ i ] [ j ] // if NIL -> ""
aExcel[ i ] [ j ] := ""
ENDIF
AADD( aLine, aExcel[ i ] [ j ] ) // Line Array
NEXT
// IF J <> 1 // no Headerline
AADD( aNew, ACLONE(aLine))
// ENDIF
NEXT
nEnde := LEN( aNew )
now we got Data in GRID but it might be that not all belong to "Data" which we want to transfer.
Programmer "expect" that in 1st ROW are Header ... but what it 1st ROW contain "other" data ?
also End must not be last Row so we need nStart, nEndRow ... and nEndCol (click in Header to show BUG)
if we got the Area we still can have Problem with FIELDPUT() while VALTYPE() might incorrect e.g. NIL
not sure about International Version of Excel : does it use "," or "." for Decimal
i have to figure out how to get "Nation" Sign e.g. for "empty" Date like " . . " or " / / " to be continue ...