S
stef
Hello,
I am generating an excel spreadsheet using a VB6 EXE and OWC11. One of
the files that is generated won't open with Excel because of the
'Problems during load' error (which specifies 'Table' as the
location'). When I view the raw XML of the file I find that for one
particular piece of data (coming straight from a database) which reads
simply '450-2', the datatype is being set as datetime as opposed to
string, so the XML reads:
<ss:Cell ss:StyleID="wc02833CA4">
<ssata ss:Type="DateTime">0450-02-01</ssata>
</ss:Cell>
The date format is obviously wrong but I don't know why it is seeing
the text '450-2' as a date anyway. All of the other entries are
recognised as strings and if I correct this in the XML the spreadsheet
then opens up fine.
Does anyone know how I set the data type of a cell using OWC11? the
code I am using at the moment is:
range2.Cells(1).Value = CStr(aryResults(FIELD_SEARCH, i))
where aryResults is loaded from a recordset getRows(). I have tried
casting the data as a string within my SQL statement as well but this
has no impact.
If I could set the Cell's data type before writing to it I think that
might work but I can't find out how to do it from the limited help
resources for OWC.
Any ideas I'd be very grateful.
Thanks very much.
Stef
I am generating an excel spreadsheet using a VB6 EXE and OWC11. One of
the files that is generated won't open with Excel because of the
'Problems during load' error (which specifies 'Table' as the
location'). When I view the raw XML of the file I find that for one
particular piece of data (coming straight from a database) which reads
simply '450-2', the datatype is being set as datetime as opposed to
string, so the XML reads:
<ss:Cell ss:StyleID="wc02833CA4">
<ssata ss:Type="DateTime">0450-02-01</ssata>
</ss:Cell>
The date format is obviously wrong but I don't know why it is seeing
the text '450-2' as a date anyway. All of the other entries are
recognised as strings and if I correct this in the XML the spreadsheet
then opens up fine.
Does anyone know how I set the data type of a cell using OWC11? the
code I am using at the moment is:
range2.Cells(1).Value = CStr(aryResults(FIELD_SEARCH, i))
where aryResults is loaded from a recordset getRows(). I have tried
casting the data as a string within my SQL statement as well but this
has no impact.
If I could set the Cell's data type before writing to it I think that
might work but I can't find out how to do it from the limited help
resources for OWC.
Any ideas I'd be very grateful.
Thanks very much.
Stef