生成Excel报告后,如果我为下载的Excel工作表打印(CTRL + P),则最后一列将转到下一页。如何解决此对齐问题。
请找到下图。
最后一栏将进入第二页。
请找到这个。FIDDLE
$("#btnExport").click(function (e) {
window.open('data:application/vnd.ms-excel,' + $('#dvData').html());
e.preventDefault();
});
body {
font-size: 12pt;
font-family: Calibri;
padding : 10px;
}
table {
border: 1px solid black;
}
th {
border: 1px solid black;
padding: 5px;
background-color:grey;
color: white;
}
td {
border: 1px solid black;
padding: 5px;
}
input {
font-size: 12pt;
font-family: Calibri;
}
<input type="button" id="btnExport" value=" Export Table data into Excel " />
<br/>
<br/>
<div id="dvData">
<table>
<tr>
<th>Column One</th>
<th>Column Two</th>
<th>Column Two</th>
<th>Column Two</th>
<th>Column Two</th>
<th>Column Two</th>
<th>Column Two</th>
<th>Column Two</th>
<th>Column Three</th>
</tr>
<tr>
<td>row1 Col1</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
</tr>
<tr>
<td>row2 Col1</td>
<td>row2 Col2</td>
<td>row2 Col3</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
</tr>
<tr>
<td>row3 Col1</td>
<td>row3 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td>row1 Col2</td>
<td><a href="http://www.jquery2dotnet.com/">http://www.jquery2dotnet.com/</a>
</td>
</tr>
</table>
</div>