PHP export Excel Currency Style
April 17th, 2013
<html xmlns:o=”urn:schemas-microsoft-com:office:office”
xmlns:x=”urn:schemas-microsoft-com:office:excel”
xmlns=”http://www.w3.org/TR/REC-html40″>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<meta http-equiv=”Content-type” content=”text/html;charset=utf-8″ />
<style id=”Classeur1_16681_Styles”>
.hkd {
mso-number-format: “\0022HKD\0022\#\,\#\#0\.00”;
}
.usd {
mso-number-format: “\0022USD\0022\#\,\#\#0\.00”;
}
.currency{
mso-number-format: “\0022$\0022\#\,\#\#0\.00”;
}
</script>
</head>
<body><div id=”Classeur1_16681″ align=center x:publishsource=”Excel”>
<table>
<tr>
<td class=”usd”>123,456</td>
</tr>
</table>
</div>
</body>
</html>
Other format
- Plain Text: mso-number-format:\@
- Format a number to 2 decimal places: mso-number-format:”0\.00″
- Comma separators with 2 decimal places: mso-number-format:\#\,\#\#0\.00
- Date \ Time Formating:
- American date: mso-number-format:mm\/dd\/yy
- Month name: mso-number-format:d\\-mmm\\-yyyy
- Date and Time: mso-number-format:d\/m\/yyyy\ h\:mm\ AM\/PM
- Short Date: mso-number-format:”Short Date” (05/06/2011)
- Medium Date: mso-number-format:”Medium Date” (10-jan-2011)
- Short Time: mso-number-format:”Short Time” (8:67)
- Medium Time: mso-number-format:”Medium Time” (8:67 AM)
- Long Time: mso-number-format:”Long Time” (8:67:25:00)
- Percentage: mso-number-format:Percent (To two decimal places)
- Scientific Notation: mso-number-format:”0\.E+00″
- Fractions – up to 3 digits: mso-number-format:”\#\ ???\/???”
- Currency (£12.76): mso-number-format:”\0022£\0022\#\,\#\#0\.00″
- 2 decimals, negative numbers in red and signed: mso-number-format:”\#\,\#\#0\.00_ \;\[Red\]\-\#\,\#\#0\.00\ ” (1.86-1.66)
- Accounting Format –5,(5): mso-number-format:”\\#\\,\\#\\#0\\.00_\\)\\;\\[Black\\]\\\\(\\#\\,\\#\\#0\\.00\\\\)”