Welcome! Log In Create A New Profile


[WD14] Problem in Excel read in

Posted by Al 
[WD14] Problem in Excel read in
February 02, 2011 02:59AM
Hello All

We have a facility to read in data from an Excel spreadsheet. The sheet is tightly formatted and the heading in each column in row 1 is used to drive the read in methods.
We have just found that if a column heading consists of numbers Windev ignores the column entirely. We can fix it with a prefix but I am curious if anyone else has observed this.

A column heading of "123" is ignored but "A123" is ok

//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
  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

I think its a bug but maybe I am doing something wrong ?


Edited 1 time(s). Last edit at 02/02/2011 07:13AM by Al.
Re: [WD14] Problem in Excel read in
February 07, 2011 09:42PM
Hello All

I had a response from Tech support advising that Windev assumes that columns with a numeric heading are assumed to be numbers and to use a prefix as a workaround.

This was my response to tech support.


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.

Are there any other suggestions as to how this problem could be be fixed ?
For the moment the only solution is to add a prefix to columns headings that only have numbers.


Your Email:


Spam prevention: