PHP export Excel Currency Style
<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\\\\)”
CSS – 區別IE6、IE7、IE8、Firefox
以下內容是從 http://sofree.cc/ie6-ie7-ie8-firefox-css-hack/ 轉載
區別IE和Firefox
【辨識符號】:「\9」
【範例練習】:
#tip {
background:blue; /*Firefox 背景變藍色*/
background:red \9; /*IE6、IE7、IE8背景變紅色*/
}
【說明】:因為IE瀏覽器看得懂「\9」,但是非IE的瀏覽器一律看不懂,因此就可以用這個語法來區分IE和 Firefox(非IE瀏覽器,像是Opera、Google Chrome、Safari等),因此以上CSS範例中,非IE瀏覽器是顯示藍色背景,IE系列瀏覽器是顯示紅色背景。 Read more…
IE bug – Colspan Bug in IE
<table border=”1″ width=”100%”>
<tr>
<th align=”center” width=”1″><input type=”checkbox” value=”2″ /></th>
<th>Name 1</th>
<th>Name 2</th>
<th>Name 3</th>
</tr>
<tr>
<td colspan=”4″>
<input type=”button” name=”it is button 1″ value=”it is button Submit 1″ />
<input type=”button” name=”it is button 2″ value=”it is button Submit 2″ />
</td>
</tr>
</table>
My Solution :
<table border=”1″ width=”100%”>
<tr>
<th align=”center” width=”1″><input type=”checkbox” value=”2″ /></th>
<th>Name 1</th>
<th>Name 2</th>
<th>Name 3</th>
</tr>
<tr>
<td colspan=”4″ style=”width:auto;”>
<input type=”button” name=”it is button 1″ value=”it is button Submit 1″ />
<input type=”button” name=”it is button 2″ value=”it is button Submit 2″ />
</td>
</tr>
</table>
Vertical Centering in CSS
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”>
<html>
<head>
<title>Universal vertical center with CSS</title>
<style>
.greenBorder {border: 1px solid green;} /* just borders to see it */
</style>
</head>
<body>
<div style=”display: table; height: 400px; #position: relative; overflow: hidden;“>
<div style=” #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;“>
<div style=” #position: relative; #top: -50%“>
any text<br>
any height<br>
any content, for example generated from DB<br>
everything is vertically centered
</div>
</div>
</div>
</body>
</html>