opening datagrid to Excel - Excel is changing the format of a column to a number from a string

I have a datagrid that has a column which is a string identity field that is 19 characters long - all the characters values are numeric.  I'm exporting and opening the datagrid in Excel using a xslt file.  Excel changes the values from string to numeric and the result is a number who's last character is incorrect and and displays in scientific notation.

Datagrid Column Value: 4003000000009010001
What I see in the resulting worksheet in Excel: 4.003E+18
What i see in the data field at the top: 4003000000009010000

The line in the xslt file

<TD>
<xsl:value-of select="IDNUMBER" />
</TD>


How can I tell Excel not to convert this data?
CaseyRobertsTTUAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ctm5Commented:
Prepend the number with an apostrophe.

ctm5
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CaseyRobertsTTUAuthor Commented:
Thanks for the suggestion. I can't have an apostrophe showing up in the final spreadsheet.  I need a way to tell Excel, through code, not to convert the string to a number.  I was hoping to be able to specify an attribute in the xslt line.
0
ctm5Commented:
You could try setting the numberformat of the column to "@" (in VB code).
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

CaseyRobertsTTUAuthor Commented:
It's not a number in my datagrid column.  It's a string value being written in XML to be opened by Excel.  Excel, based on the fact that all the characters are numbers, changes it for me.  I have no control of the users Excel program, just the file I'm creating.  I'd like to know how to explicitly declare a field as a string in XML or in the XSLT - without adding string characters to my data.

XML line is: <IDNUMBER>4003000000009010001</IDNUMBER>
0
ctm5Commented:
Right, you have control of the file you are creating. Which is an Excel spreadsheet, right? So you can figure out (in code) what column it is that is a problem and set its format to "@" This is done in the VB code (which I assume you must resort to at some point, since you have posted this in the VB.NET forum). If you want to do it in XML or XSLT, you might try a different forum. (In your original question, you did not specify a solution must lie in the XML or XSLT.)

ctm5
0
CaseyRobertsTTUAuthor Commented:
Sorry, for the confusion.  I'm not writing an Excel file (.xls). The VB.Net program is taking the data from my datagrid columns and writing an XML file to be opened by Excel.  In the XML file the data is correct.  I need a way to write the XML file in such a way that Excel doesn't reformat the data when it opens it.

I have added this question to the XML area, but no response there yet.  

Thanks for your suggestions so far.  
0
CaseyRobertsTTUAuthor Commented:
I decided to use the apostrophe as a temporary solution until I can find the answer I need.  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.