Al
[WD14] Problem in Excel read in February 02, 2011 02:59AM |
Moderator |
//get the number of columns, ignore empty columns LColNum = xlsNbColumn (XLSFileID, True) //column headings are ColA,123,ColC //this count is always correct, so it is seeing the column headed "123" //and at this point LColNum = 3 which is correct FOR LColcounter = 1 TO LColNum //this loop reads the columns from 1 to the last column LDatares = xlsData(XLSFileID, XLSRecRead, LColcounter, False ) LColHeader= xlsColumnTitle (XLSFileID, LColcounter, True ) SWITCH NoSpace(Upper(LColHeader)) //case statements End LColCOunter ++ End //FOR LColcounter = 1 TO LColNum //When LColCounter = 1 LColHeader = "ColA" //When LColCOunter = 2 it ignores the second column "123" and the code LColHeader= xlsColumnTitle (XLSFileID, LColcounter, True ) returns the third column "ColA" as the second column title. The xlsNbColumn() always returns the correct number of columns regardless of their heading but the other commands ignore columns with number headings If I change the second column heading to "A123" everything is fine
Al
Re: [WD14] Problem in Excel read in February 07, 2011 09:42PM |
Moderator |
Quote
I would suggest that this is a bug and that Windev's assumption is wrong.
Windev should not make that assumption regarding the data on my behalf.
If I explicitly ask Windev to get me the title using xlsColumnTitle () on that cell then at the very least it should return the contents of the cell as a string so I could test it for being numeric.
There is an additional problem because there is a conflict with the xlsNbColumn() command which correctly returns the number of non blank columns so it is counting the columns correctly even though one of them has a numeric header.
So the situation is that one Windev command tells me I have x number of columns and another Windev command ignores one or more of those coulmns. Surely that needs attention rather than me using a permanent workaround ? I don't always have control over the column headings in data I receive from clients.
Perhaps what is required is a method of nominating a row as a header row for the express purpose of retrieving column headings. Would you lodge that as a suggestion please.
Would you also lodge a second suggestion to change xlsColumnTitle () so that it returns either the cell content as a string or an error indicating that it does not regard that column as valid.