WriteXML issue

ar_pad

Active member
Joined
Jun 5, 2006
Messages
26
Programming Experience
Beginner
hi,

I'm facing a strange pbm while converting excel file to xml.
If excel file has decimal datas, then some of the decimal datas will be appeared in converted xml file as shown below

HTML:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Attendance>
<Mas>M</Mas>
<CustG>X</CustG>
<PT>0</PT>
<R1>11</R1>
<R2>20</R2>
</Attendance>
<Attendance>
<Mas>M</Mas>
<CustG>X</CustG>
<PT>1</PT>
<R1>10.8</R1>
<R2>10.9</R2>
</Attendance>
<Attendance>
<Mas>M</Mas>
<CustG>X</CustG>
<PT>2</PT>
<R1>10.6</R1>
<R2>10.700000000000001</R2>
</Attendance>
<Attendance>
<Mas>M</Mas>
<CustG>X</CustG>
<PT>3</PT>
<R1>10.4</R1>
<R2>10.5</R2>
</Attendance>
<Attendance>
<Gender>M</Gender>
<Age>X</Age>
<PT>4</PT>
<R1>10.200000000000001</R1>
<R2>10.3</R2>
</Attendance>
Instead of 10.2 it appears 10.200000000000001.
If i read the above xml file and bind to datagrid ,it appears 10.2 only. not the long one. so very much confused
How to solve this issue?

Thanks!
 
Last edited by a moderator:
Excel format the decimals for itsself. Then when you see all that in XML document you see entire decimal numbers (not formated).
Notice that you can use string.format(pattern, value) to cut down the decimals if you want and make it appears with as much decimals as you want. But in XML doc values will always appear entirely.
Regards ;)
 
Back
Top