Leonard Sitongia wrote:
Hello,
My apologies if this question has been asked before, but OOo support
mailing list archives are giving an error when accessing via the web.
I have a data source which is backed by a spreadsheet. It happens
that the spreadsheet data is a mailing list. One column is US zip
codes. Most are 5-digit numbers. Some are 9-digit, with #####-####.
When looking at the data source/Tables/Sheet1, the cells with the
9-digit numbers are empty. The cells that have 5-digit zip codes are
fine, but the 9-digit ones are null.
Now, I thought this might be caused by the format of the cells, and
the presence of the minus sign. But, it happens that the next column
is phone numbers, which are ###-###-#####. They all show just fine in
the spreadsheet and in the view of the data source.
The cell formats for the zip code and the phone number columns are the
same. I can't explain why the cells with 9-digit zip codes are
showing empty in the data source view.
Thanks for your help,
==Leonard
At this point, the data has been moved around a bit so perhaps not all
of the data is the same.
For example, if I enter the number 12345 into a Calc document, I enter a
number. If I enter the text 12345-12345 then it is entered as a string
rather than a number. I created a sheet and added 12345 in cell A1 and
12345-12345 in cell A2. I then ran the following macro to verify...
Sub CheckCellType
Dim oCell
Dim oSheet
oSheet = ThisComponent.getSheets().getByIndex(0)
REM Get Cell A1, which contains "12345"
oCell = oSheet.getCellByPosition(0, 0)
Print oCell.getString() REM 12345
Print oCell.getValue() REM 12345
oCell = oSheet.getCellByPosition(0, 1)
Print oCell.getString() REM 12345-12345
Print oCell.getValue() REM 0
End Sub
When you make your connection, the column type is probably deteremined
by the value in the first row. Well, your first row probably contains
the header value so it is probably really row 2. If this is a five digit
number then the type is set to be a number. When you then find text, it
is returned as zero because it is expected to be a number.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info: http://www.pitonyak.org/oo.php
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]