请教下asp.net下如何才能在脚本控制打印属性我原本用的Webbroser控件 虽然功能很强大 但是打印的选纸,横向打印,无法用代码实现,请教高手如何解决或者有没有其他方法能在程序中控制好打印设置,不需要用户在打印设置中设置.
顺便问一下,我用的sheet表,带滚动条,打印时只能打印显示的部分,但是我需要显示所有数据切横向排版
顺便问一下,我用的sheet表,带滚动条,打印时只能打印显示的部分,但是我需要显示所有数据切横向排版
AUTHOR: Pat Heard (fullahead.org)
DATE: 2006.09.12
PURPOSE: Styles the page for print. Techniques adopted from
http://www.alistapart.com/articles/goingtoprint/
**************************************************************/body {
font: 400 12pt verdana, arial, sans-serif;
color: #000;
background: #FFF;
}h1 {
margin-top: 30px;
font-size: 18pt;
border-bottom: 1px solid #999;
}h2 {
font-size: 16pt;
}h3 {
font-size: 14pt;
}h4, h5, h6 {
font-size: 12pt;
}acronym {
border: 0;
}a {
color: #00F;
}/* Prints the URL after a link in CSS2 supporting browsers */
a:link:after,
a:visited:after {
content: " (" attr(href) ") ";
font-size: 90%;
}
/* Don't display these elements since they're not useful on paper */
#header,
#menu,
.footer {
display: none;
}#content {
width: auto;
margin: 0 8%;
padding: 0;
}
<head>
<title>打印确认 </title>
<style media="print">
.noprint { display: none }
</style>
</head>
<body>
<object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"> </object>
<script defer>
function window.onload() {
factory.printing.header = "自定义页头"
factory.printing.footer = "数码在线"
factory.printing.portrait = false
idPrint1.disabled = false; // enable UI button
idPrint2.disabled = false;
idPrint3.disabled = false;
idPrint4.disabled = false;
factory.printing.leftMargin = 0.75
factory.printing.topMargin = 1.5
factory.printing.rightMargin = 0.75
factory.printing.bottomMargin = 1.5
}
</script>
<div class=noprint>
<input id="idPrint1" type="button" value="打印本页"
onclick="factory.printing.Print(false)">
<input id="idPrint2" type="button" value="页面设置"
onclick="factory.printing.PageSetup()">
<input id="idPrint3" type="button" value="打印预览"
onclick="factory.printing.Preview()">
<input id="idPrint4" type="button"
onclick="window.close()" value="关闭窗口">
</div>
<br>
<table width="720" border="0" cellspacing="0" cellpadding="0" align="center" >
<tr>
<td width="2" bgcolor="#0099ff">
这里是你要打印的内容,上面的按钮不会被打印出来 <br>
如果你有什么内容不想打印,用将其样式定义为noprint即可
</td>
</tr> </table> </body>