Excel to XML: Round decimals to the nearest hundredth and keep hyperlinks

accertaiz

New Member
I followed this guide to export an Excel Spreadsheet as an XML data file and then this guide to display the XML sheet as an HTML table on my website. It worked great. Now I "only" have to small issues remaining that I couldn't get solved.(1) The output table contains numbers like 1.325667 but also lots of 0s. I would like the zeroes to be displayed as 0.00 and the numbers with many decimals to be displayed as 1.33. Basically, each number should be displayed with two decimals.(2) The excel sheet contains hyperlinks to other pages on my website that I would like to keep when rendering the XML data file and then the HTML table. So far, that didn't work. Is this possible? UPDATE I figured this part out. By breaking up the hyperlinks in just their character-strings, then adding new columns for these character strings, and then tweaking the source code to including\[code\]document.write("<tr><td><a href='");document.write(x.getElementsByTagName("character-string")0].childNodes[0].nodeValue);document.write(".php'>");document.write(x.getElementsByTagName("name")[0].childNodes[0].nodeValue);document.write("</a></td>"); \[/code\]I was able to include hyperlinks.The Excel-Sheet is formatted with these two aspects already integrated, but the conversion to an XML file seems to be the problem.Thank you so much for your help (again and again :-)) UPDATE I now also found a way to do the rounding in Excel, but I'm still stuck with integers and numbers with only one decimal. Basically, I now "only" need a way to show every number with two decimal points, applying to integers (e.g. 0 should 0.00) and numbers with one decimal (e.g. 1.5 should be 1.50). JohnnyReeves' answer seems to be on the right track but I couldn't get it to work. Any other ideas?
 
Back
Top