2016-03-29 1 views
-3

Ich habe versucht, dieses Problem jetzt zu lösen. Dieses Problem bezieht sich nur auf Chrome. Wenn ich Seite auf einer Website drucke, die ich arbeite, überspannen die Tabellenzellen die ganze Reihe. Anstatt also eine Tabelle mit 5 Zeilen in der Druckseite zu haben, zeigt sie jede Zelle als eine Zeile voller Breite an. Ich habe eine Druckseite css, die ich versucht habe, die Breite von td und der Tabelle zu steuern, aber es lässt noch jede Zelle in eine neue Reihe fallen. Druckt perfekt mit FireFox. Jede Hilfe würde sehr geschätzt werden.Seite in Chromtabellenausgaben drucken

Danke.

+0

Bitte lesen [fragen]. – CBroe

Antwort

0
Try this way: 
where var data= $("#divtoprint").html(); 
    function ShowPrintWindowPopup(data) { 
     var mywindow = window.open(); 
     mywindow.document.write('<html><head><title></title>'); 
     mywindow.document.write('<style>'); 
     mywindow.document.write('table, th, td { border-collapse: collapse;border: 1px solid black;width: 100%;text-align: left;border-spacing: 0;}'); 
     mywindow.document.write('a {color: #428bca;text-decoration: none;} ,table > tbody > tr {height:auto!important},table > thead > tr > th, table > tbody > tr > th, table > tfoot > tr > th, table > thead > tr > td, table > tbody > tr > td, table > tfoot > tr > td{vertical-align:top;padding:2px;font-size:8px;}'); 
     mywindow.document.write('table {border-collapse:collapse; table-layout:fixed;} , table td {border:solid 1px #fab; word-wrap:break-word; -ms-word-break: break-all; word-break: break-all; word-break: break-word;-webkit-hyphens: auto;-moz-hyphens: auto;-ms-hyphens: auto;hyphens: auto;}') 
     mywindow.document.write('</style>'); 
     mywindow.document.write('</head><body style="direction:ltr;font-size:10px;">'); 
     mywindow.document.write('<div style="text-align:center;font-size:16px;font-weight:bold;">title</div><br />'); 
     mywindow.document.write('<br/><br/>'); 
     mywindow.document.write(data); 
     mywindow.document.write('</body></html>'); 
     mywindow.document.close(); 
     mywindow.print(); 
     return true; 


    }