2017-03-13 17 views
0

Excel로 내보내기 HTML에 table2excel.js를 사용하고 있으며 정상적으로 작동합니다. 조건에 따라 행 또는 열 색상을 변경하고 싶습니다. 가능한가?Excel 서식 지정 table2excel.js

<table id="ExcelTable" style="text-align: left;display:none"> 
    <tr class="rpthide"> 
     <td class="Supplier" style="font-size:14px;"></td> 
     <td class="ContractNo" style="font-size:14px;"></td> 
     <td class="OrderNo" style="font-size:14px;"></td> 
     <td class="Article" style="font-size:14px;"></td> 
     <td class="Ordered" style="font-size:14px;"></td> 
     <td class="ContainerNo" style="font-size:14px;"></td> 
     <td class="ETA" style="font-size:14px;"></td> 
     <td class="Dispatched" style="font-size:14px;"></td> 
     <td class="AtPort" style="font-size:14px;"></td> 
     <td class="Arrived" style="font-size:14px;"></td> 

    </tr> 
</table> 

$("#ExcelTable").table2excel({ 
       // exclude CSS class 
       exclude: ".noExl", 
       name: "Yarn Status List", 
       filename: "Yarn Status List" //do not include extension 
      }); 
+0

당신이 코드는 지금까지 가지고 올 것을 보여주는 제공 할 수 있습니까? – Arg0n

+0

Office 버전이 무엇을 능가합니까? 내 PC에서 생성 된 파일을 열 수 없습니다. –

답변

0

나는 당신이 HTML 테이블에있는 CSS 스타일을 적용 할 수 있습니다 ExcellentExport.js로 같은 더 나은 도구를 사용하는 것이 좋습니다, 그리고 그들은 출력에 보냅니다.

샘플 사용법 :

<script src="excellentexport.js"></script> 

<table id="ExcelTable"> 
    <tr> 
    <td style="color:red">Column 1</td> 
    <td style="color:blue">Column 2</td> 
    <td style="color:green; font-weight:bold">Column 3</td> 
    </tr> 
    <tr style="color: purple"> 
    <td>400</td> 
    <td>500</td> 
    <td>600</td> 
    </tr> 
</table> 

<a download="myFile.xls" href="#" onclick="return ExcellentExport.excel(this, 'ExcelTable', 'Sheet1');">Export to Excel</a>