2012-10-19 3 views

답변

3

print.css 스타일 시트를 만들고 거기에 표시되도록 테이블을 설정하십시오. 추가, 다음

<link rel="stylesheet" media="print" href="/path/to/print.css" type="text/css" /> 

print.css 내부 : 테이블을 인쇄 할 페이지

, 추가

<link rel="stylesheet" href="print.css" type="text/css" media="print" /> 
1

display 특성 table에 인쇄 스타일 시트를 추가하고 설정

table { 
    display: table; 
    visibility: visible; 
} 
+0

외부 CSS를 사용하고 싶지 않습니다. 인라인 CSS를 사용하여 숨겨진 테이블을 인쇄하는 방법이 있습니까? – Ganesh

+0

아니요. CSS를 인라인하는 것은 주된 측면에서 실제로 나쁜 습관입니다. 왜 당신은 외부 CSS를 사용하고 싶지 않아? – BenM

+0

외부 CSS에서 수행 할 수 있다면 인라인으로도 해당 기능을 지원한다고 생각합니다. 그리고 난 단지 2 페이지와 함께 1 페이지를 가지고 있고이 파일 (HTML 파일)을 사용 하여이 인쇄를 완료해야합니다. – Ganesh

0

시험해보기 :

<a href="javascript:void(0);" id="printPage">Print</a> 
<table id="tblprint" style="visibility:hidden;"> 
    <tr> 
     <td>Print Data</td> 
    </tr> 
</table> 

<script lang='javascript'> 
$(document).ready(function(){ 
    $('#printPage').click(function(){ 
     var data = '<input type="button" value="Print this page" onClick="window.print()">';   
     data += '<div id="div_print">'; 
     data += $('#tblprint').html(); 
     data += '</div>'; 

     myWindow=window.open('','','width=200,height=100'); 
     myWindow.innerWidth = screen.width; 
     myWindow.innerHeight = screen.height; 
     myWindow.screenX = 0; 
     myWindow.screenY = 0; 
     myWindow.document.write(data); 
     myWindow.focus(); 
    }); 
}); 
</script> 
관련 문제