<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>S i X h E a D { ? } &#187; export</title>
	<atom:link href="http://sixhead.com/tag/export/feed/" rel="self" type="application/rss+xml" />
	<link>http://sixhead.com</link>
	<description>เมื่อความรู้มีไว้แบ่งปัน</description>
	<lastBuildDate>Tue, 23 Feb 2010 14:36:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Export เป็น Microsoft Word อย่างด่วน</title>
		<link>http://sixhead.com/2008/09/28/easy-export-to-microsoft-word/</link>
		<comments>http://sixhead.com/2008/09/28/easy-export-to-microsoft-word/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 16:17:23 +0000</pubDate>
		<dc:creator>Pipo</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://sixhead.com/?p=188</guid>
		<description><![CDATA[ระบบ Program หน้า backend ของการเขียนโปรแกรมนั้น โดยทั่วไปแล้วการมี หน้าสรุป, หน้ารายงานข้อมูลต่างๆ ถือเป็นหัวใจสำคัญทีเดียว การสร้างมูลค่าเพิ่ม (ให้งานดูดีมีระดับและได้เงินค่าจ้างเพิ่มขึ้น) ก็คือการสร้างรายงานที่เป็น Microsoft Excel, Microsoft Word นั่นเองเนื่องจาก ไฟล์ 2 ประเภทนี้สามารถส่งต่อไปยังผู้ที่เกี่ยวข้องได้ง่ายกว่า การที่ต้องมานั่ง login ทุกครั้งที่อยากดูข้อมูล พูดมากไปแล้วมาเข้าเรื่องกันเลย คราวนี้ถือเป็นภาคต่อจากบทความ Export เป็น Excel อย่างด่วน บทความนี้ดูตัวอย่าง ได้ที่นี่ มาดู code กัน
PHP ส่วนหัวเป็นการสร้าง header เพื่อให้ browser รู้ว่าเอกสารหน้านี้เป็น Microsoft Word
&#60;?php
$strWordFileName    =    &#34;Word ไฟล์ง่ายนิดเดียว.doc&#34;;
header&#40;&#34;Content-Type: application/vnd.ms-word; name=\&#34;$strWordFileName\&#34;&#34;&#41;;
header&#40;&#34;Content-Disposition: inline; filename=\&#34;$strWordFileName\&#34;&#34;&#41;;
header&#40;&#34;Pragma: no-cache&#34;&#41;;
?&#62;
ส่วนบนของ [...]]]></description>
			<content:encoded><![CDATA[<p>ระบบ Program หน้า backend ของการเขียนโปรแกรมนั้น โดยทั่วไปแล้วการมี หน้าสรุป, หน้ารายงานข้อมูลต่างๆ ถือเป็นหัวใจสำคัญทีเดียว การสร้างมูลค่าเพิ่ม (ให้งานดูดีมีระดับและได้เงินค่าจ้างเพิ่มขึ้น) ก็คือการสร้างรายงานที่เป็น Microsoft Excel, Microsoft Word นั่นเองเนื่องจาก<br/><span id="more-188"></span> ไฟล์ 2 ประเภทนี้สามารถส่งต่อไปยังผู้ที่เกี่ยวข้องได้ง่ายกว่า การที่ต้องมานั่ง login ทุกครั้งที่อยากดูข้อมูล พูดมากไปแล้วมาเข้าเรื่องกันเลย คราวนี้ถือเป็นภาคต่อจากบทความ <a href="http://sixhead.com/2008/03/06/easy-export-to-excel">Export เป็น Excel อย่างด่วน</a> บทความนี้ดูตัวอย่าง <a href="http://sixhead.com/testrun/php/export/easy-word.php">ได้ที่นี่</a> มาดู code กัน</p>
<p>PHP ส่วนหัวเป็นการสร้าง header เพื่อให้ browser รู้ว่าเอกสารหน้านี้เป็น Microsoft Word
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #0000ff;">$strWordFileName</span>    =    <span style="color: #ff0000;">&quot;Word ไฟล์ง่ายนิดเดียว.doc&quot;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Type: application/vnd.ms-word; name=<span style="color: #000099; font-weight: bold;">\&quot;</span>$strWordFileName<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Disposition: inline; filename=<span style="color: #000099; font-weight: bold;">\&quot;</span>$strWordFileName<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Pragma: no-cache&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>ส่วนบนของ HTML ด้านล่างนี้ บอกว่าเอกสารต่อไปนี้ชนิดเป็นอะไร ซึ่งก็คือ Microsoft Word นั่นเอง ส่วนเนื้อหากลางๆ หน้าดูให้ดีก็คือ HTML ล้วนๆ
<pre class="html4strict">&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">&lt;html</span></a> xmlns:o=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:office:office&quot;</span>
xmlns:x=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:office:word&quot;</span>
xmlns=<span style="color: #ff0000;">&quot;http://www.w3.org/TR/REC-html40&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">&lt;html&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></a></span>
    <span style="color: #009900;"><a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">&lt;meta</span></a> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html;charset=TIS-620&quot;</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></a></span>
&nbsp;
ทดลองสร้างไฟล์ Microsoft Word จาก HTML<span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">&lt;table</span></a> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">cellpadding</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">cellspacing</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000; font-weight: bold;">&lt;th</span></a> <span style="color: #000066;">bgcolor</span>=<span style="color: #ff0000;">&quot;#96BB00&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Field<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/th&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000; font-weight: bold;">&lt;th</span></a> <span style="color: #000066;">bgcolor</span>=<span style="color: #ff0000;">&quot;#FFFF99&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">&lt;b&gt;</span></a></span>Type<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/b&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/th&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000; font-weight: bold;">&lt;th</span></a> <span style="color: #000066;">bgcolor</span>=<span style="color: #ff0000;">&quot;#96BB00&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">&lt;b&gt;</span></a></span>Null<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/b&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/th&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">&lt;b&gt;</span></a></span>ConnectId<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/b&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>int(10)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>Yes<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>MachineName<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>varchar(50)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>Yes<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>HDModel<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>varchar(50)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span>Yes<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table&gt;</span></span>
&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/font.html"><span style="color: #000000; font-weight: bold;">&lt;font</span></a> <span style="color: #000066;">color</span>=<span style="color: #ff0000;">&quot;#339900&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>ใช้งานกับภาษาไทยได้ดีทีเดียว<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/font&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></pre>
<p>จากตัวอย่างจะเห็นได้ง่ายๆ เลยว่าเราพลิกจากหน้า report ธรรมดา สร้างมูลค่าเพิ่มให้มันกลายเป็น Microsoft Word ได้ในพริบตาทีเดียว ดาวน์โหลด <a href="http://sixhead.com/testrun/php/export/easy-word.phps">source code ได้ที่นี่</a></p>
<p><map name='google_ad_map_188_f21c57aff87a446f'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/188?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_188_f21c57aff87a446f' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=188&amp;url= http%3A%2F%2Fsixhead.com%2F2008%2F09%2F28%2Feasy-export-to-microsoft-word%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://sixhead.com/2008/09/28/easy-export-to-microsoft-word/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Export เป็น Excel อย่างด่วน</title>
		<link>http://sixhead.com/2008/03/06/easy-export-to-excel/</link>
		<comments>http://sixhead.com/2008/03/06/easy-export-to-excel/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 16:29:55 +0000</pubDate>
		<dc:creator>Pipo</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[editplus]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[header]]></category>

		<guid isPermaLink="false">http://sixhead.com/2008/03/06/export-to-excel/</guid>
		<description><![CDATA[ในงานหลายๆ งานที่ต้องมีการ export ข้อมูลออกมา เมื่อก่อนงูๆ ปลาๆ แค่ทำเป็น csv ต่อมาเริ่มหาเครื่องมือช่วยแล้วก็ได้ php_writeexcel ดูตัวอย่างการทำงาน ได้ที่นี่ เป็น class ที่ช่วยสร้าง excel จริงๆ ขึ้นมาได้ ซึ่งใช้ได้ดีมากๆ แต่ในบางครั้งแค่ต้องการ export ข้อมูลอย่างเดียวเราสามารถใช้วิธีสร้างไฟล์ excel ง่ายๆ จาก code html ได้เลย 
 ดูตัวอย่าง ได้ที่นี่ มาดู code กัน 
&#60;?
$strExcelFileName	=	&#34;Excel ไฟล์ง่ายนิดเดียว.xls&#34;;
header&#40;&#34;Content-Type: application/x-msexcel; name=\&#34;$strExcelFileName\&#34;&#34;&#41;;
header&#40;&#34;Content-Disposition: inline; filename=\&#34;$strExcelFileName\&#34;&#34;&#41;;
header&#40;&#34;Pragma: no-cache&#34;&#41;;
?&#62;
ส่วนนี้เป็น header ของ server (website) เพื่อบอก client (browser IE,FireFox, etc..) ว่าเอกสารที่กำลังเรียกมานี้เป็น excel เรื่อง header นี้ถ้ารักจะเป็น [...]]]></description>
			<content:encoded><![CDATA[<p>ในงานหลายๆ งานที่ต้องมีการ export ข้อมูลออกมา เมื่อก่อนงูๆ ปลาๆ แค่ทำเป็น csv ต่อมาเริ่มหาเครื่องมือช่วยแล้วก็ได้ <a href="http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/">php_writeexcel</a> ดูตัวอย่างการทำงาน <a href="http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/demo/">ได้ที่นี่</a> เป็น class ที่ช่วยสร้าง excel จริงๆ ขึ้นมาได้ ซึ่งใช้ได้ดีมากๆ แต่ในบางครั้งแค่ต้องการ export ข้อมูลอย่างเดียวเราสามารถใช้วิธีสร้างไฟล์ excel ง่ายๆ จาก code html ได้เลย </p>
<p><span id="more-34"></span> ดูตัวอย่าง <a href="http://sixhead.com/testrun/php/export/easy-excel.php">ได้ที่นี่</a> มาดู code กัน </p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #0000ff;">$strExcelFileName</span>	=	<span style="color: #ff0000;">&quot;Excel ไฟล์ง่ายนิดเดียว.xls&quot;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Type: application/x-msexcel; name=<span style="color: #000099; font-weight: bold;">\&quot;</span>$strExcelFileName<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Disposition: inline; filename=<span style="color: #000099; font-weight: bold;">\&quot;</span>$strExcelFileName<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Pragma: no-cache&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>ส่วนนี้เป็น header ของ server (website) เพื่อบอก client (browser IE,FireFox, etc..) ว่าเอกสารที่กำลังเรียกมานี้เป็น excel เรื่อง header นี้ถ้ารักจะเป็น web developer จำเป็นต้องรู้นะครับ ทำอะไรได้มากมายเลย  เช่น debug program ที่เกี่ยวกับ www, debug flash + php ฯลฯ จะทำให้ทำงานได้เร็วขึ้นเยอะ หรือรวมไปถึงเรื่อง hack เลยทีเดียว ไว้เรื่อง header จะขอแยกเป็นอีกเรื่องหนึ่งในภายหลังครับ</p>
<pre class="html4strict"><span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">&lt;html</span></a> xmlns:o=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:office:office&quot;</span>
xmlns:x=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:office:excel&quot;</span>
xmlns=<span style="color: #ff0000;">&quot;http://www.w3.org/TR/REC-html40&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">&lt;html&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">&lt;meta</span></a> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html;charset=tis-620&quot;</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">&lt;style</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;SiXhEaD_Excel_Styles&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/style&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">&lt;strong&gt;</span></a></span>ตัวอย่างรายงาน<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;SiXhEaD_Excel&quot;</span> <span style="color: #000066;">align</span>=center x:publishsource=<span style="color: #ff0000;">&quot;Excel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">&lt;table</span></a> x:str <span style="color: #000066;">border</span>=<span style="color: #cc66cc;">0</span> <span style="color: #000066;">cellpadding</span>=<span style="color: #cc66cc;">0</span> <span style="color: #000066;">cellspacing</span>=<span style="color: #cc66cc;">0</span> <span style="color: #000066;">width</span>=<span style="color: #cc66cc;">100</span>% <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;border-collapse: collapse&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span><span style="color: #009900;"><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">&lt;strong&gt;</span></a></span>Id<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;80&quot;</span> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span><span style="color: #009900;"><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">&lt;strong&gt;</span></a></span>จังหวัด<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;80&quot;</span> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span><span style="color: #009900;"><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">&lt;strong&gt;</span></a></span>โทรศัพท์<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span>00001<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span>กรุงเทพฯ<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span>0810000000<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span>00002<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span>กาญจนบุรี<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">class</span>=xl2216681 nowrap&gt;</span>0819999999<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></pre>
<p> ส่วนนี้เป็น tag html ล้วนๆ มีสิ่งที่พิเศษอยู่หน่อยตรง 3 บรรทัดแรกที่ระบุว่า รูปแบบของไฟล์นี้เป็น excel</p>
<pre>class=xl2216681</pre>
<p>ใส่เลข random อะไรก็ได้แต่ให้เหมือนกันทั้งหน้า</p>
<p>จะเอาไปใช้งานก็ดูตัวอย่างดีๆ นะครับ tag บางอันถ้าไม่มีก็ยังออกมาเป็น excel ได้ แต่ว่าบาง column ที่มี 0 นำหน้าเลข 0 จะหายไปครับ</p>
<p>ทิ้งท้าย<br />
- <a href="http://sixhead.com/testrun/php/export/easy-excel.phps">source code</a><br />
- ตัว phpmyadmin ที่เราๆ ท่านๆ ใช้กันอยู่ก็ใช้วิธี export ออกเป็น excel ด้วยวิธีนี้เช่นกัน<br />
- ผมแนะนำนะครับว่า พวกไฟล์ทั้งหลายอย่าไปคิดว่ามันเปิดด้วย excel หรือ word ได้เท่านั้น ลองเอา editplus หรือ notepad เปิดไฟล์ .xls ที่ได้จากวิธีการนี้ดูแล้วคุณจะประหลาดใจกับมันครับ เรื่องเปิดไฟล์ใดๆ ด้วย editplus ยังทำให้คุณแปลกใจอะไรได้อีกมากมาย ลองดูแล้วกันครับ</p>
<p><map name='google_ad_map_34_f21c57aff87a446f'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/34?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_34_f21c57aff87a446f' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=34&amp;url= http%3A%2F%2Fsixhead.com%2F2008%2F03%2F06%2Feasy-export-to-excel%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://sixhead.com/2008/03/06/easy-export-to-excel/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
