OWC11 - Generated XML has wrong data type

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">
<ss:Data ss:Type="DateTime">0450-02-01</ss:Data>
</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
 
S

stef

Did try this and am explicitly casting the result to a string but it is
still setting some entries as DateTime types for some reason which I
can't seem to fix. Would anyone have any other ideas?

Thanks very much again,

Stef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top