¹®¼³»¿¡ Á¸ÀçÇÏ´Â Å×À̺íÀÇ µ¥ÀÌÅ͸¦ ¿¢¼¿ÈÇÏ¿© ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù.
jQuery Plugin À̸ç, ¶óÀ̼¾½º´Â MIT ÀÔ´Ï´Ù.
¼Ò½º´Ù¿îÀ» ´©¸£½Ã¸é ¾ÐÃà ÆÄÀÏÀ» ´Ù¿î·Îµå ¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.
¾ÐÃà ÇØÁ¦Çϼż Æú´õ·Î µé¾î°¡¸é demo Æú´õ°¡ ÀÖ½À´Ï´Ù.
index.html ÆÄÀÏÀº ¿øº»ÆÄÀÏÀ̸ç, happy.html Àº Á¦°¡ ÀÓÀÇ·Î °¡°øÇÑ ÆÄÀÏ ÀÔ´Ï´Ù.
½ÉÇÃÇÑ Äڵ带 º¸°í ½Í´Ù¸é happy.html À» º¸½Ê½Ã¿ä.
»ç¿ë¹ýÀº ¸Å¿ì ½ÉÇà ÇÕ´Ï´Ù.
1. ¶óÀ̺귯¸®¸¦ È£ÃâÇϼ¼¿ä.
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="../dist/jquery.table2excel.js"></script>
2. ¿¢¼¿·Î ¸¸µé µ¥ÀÌÅÍÀÇ Å×À̺íÀ» ¸¸µé¾î ÁÖ½ÃµÇ class ¸íÀº ¸ÂÃçÁÖ¼Å¾ß ÇÕ´Ï´Ù.
<table class="table2excel" data-tableName="Test Table 1">
<tr>
<td>¹øÈ£</td>
<td>À̸§</td>
<td>ÀüȹøÈ£</td>
<td>¹è¼ÛÁö</td>
<td>ÁÖ¹®¹øÈ£</td>
<td>¹è¼Û¸Þ¸ð</td>
</tr>
<tr>
<td>1</td>
<td>È«±æµ¿1</td>
<td>010-1111-1111</td>
<td>´ë±¸ ´Þ¼±¸ µÎ·ùµ¿ 776-1</td>
<td>N-192858291-D9S8</td>
<td>¹®¾Õ¿¡ µÎ½Ã°í ¹®ÀÚ ÁÖ¼¼¿ä.</td>
</tr>
<tr>
<td>2</td>
<td>È«±æµ¿2</td>
<td>010-2222-2222</td>
<td>´ë±¸ ´Þ¼±¸ µÎ·ùµ¿ 776-22</td>
<td>N-195682958782-01-du29</td>
<td>°æºñ½Ç·Î .... ^^</td>
</tr>
<tr>
<td>3</td>
<td>È«´Þ·¡</td>
<td>010-777-7777</td>
<td>´ë±¸ ´Þ¼±¸ µÎ·ùµ¿ 722-1</td>
<td>N-192858291-D9S8</td>
<td>Àú³á 10½Ã¿¡ ¹è¼ÛÇØÁÖ¼¼¿ä. ±× ¿ÜÀÇ ½Ã°£¿£ ¾È ¹Þ½À´Ï´Ù. </td>
</tr>
</table >
<button class="exportToExcel">Export to XLS</button>
3. ¹öÆ°À» Ŭ¸¯ÇÏ¸é ½ÇÇàµÉ Ç÷¯±×ÀÎ ½ÇÇàÇÏ´Â Äڵ带 Ãß°¡Çϼ¼¿ä.
$("exportToExcel").click(function(e){
$("#yourHtmTable").table2excel({
exclude: ".excludeThisClass",
name: "Worksheet Name",
filename: "SomeFile.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
»ç¿ëÇϱ⵵ Æí¸®Çϱ¸¿ä.
°á°ú¹°µµ ³ª¸§ ±¦Âú½À´Ï´Ù. ^^
|