<head>
<title>MeadCo's ScriptX: Print</title>
<!-- special style sheet for printing -->
<style media="print">
.noprint { display: none }
</style>
</head><body scroll="auto"><!-- MeadCo Security Manager - using evaluation license -->
<object viewastext style="display:none"
classid="clsid:5445be81-b796-11d2-b931-002018654e2e"
codebase="smsx.cab#Version=6,1,431,2">
  <param name="GUID" value="{87530A67-6E2E-4991-8D2D-6F0208414B4B}">
  <param name="Path" value="sxlic.mlf">
  <param name="Revision" value="0">
</object><!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object><script defer>
function window.onload() {
  factory.printing.header = "MeadCo's ScriptX: Print"
  factory.printing.footer = "The de facto standard for advanced web-based printing"
  factory.printing.portrait = false
  idPrint.disabled = false; // enable UI button
}function Print() {
  factory.printing.Print(false); // no prompt
}
</script><p>Hello, world!</p><div class=noprint>
<hr>The button itself will not be printed:
<input id=idPrint disabled type="button" value="Print w/o prompt" onclick="Print()">
</div></body><script defer>
function SetPrintSettings() {
  // -- advanced features
  factory.printing.SetMarginMeasure(2); // measure margins in inches
  factory.printing.printer = "HP DeskJet 870C";
  factory.printing.paperSize = "A4";
  factory.printing.paperSource = "Manual feed";
  factory.printing.collate = true;
  factory.printing.copies = 2;
  factory.printing.SetPageRange(false, 1, 3); // need pages from 1 to 3  // -- basic features
  factory.printing.header = "This is MeadCo";
  factory.printing.footer = "Advanced Printing by ScriptX";
  factory.printing.portrait = false;
  factory.printing.leftMargin = 1.0;
  factory.printing.topMargin = 1.0;
  factory.printing.rightMargin = 1.0;
  factory.printing.bottomMargin = 1.0;
}function Print(frame) {
  factory.printing.Print(true, frame) // print with prompt
}
</script>

解决方案 »

  1.   

    用CSS里的Print中的size属性auto,portrait,landscape
      

  2.   

    ActiveSheet.PageSetup.PaperSize = 9
    ActiveSheet.PageSetup.Orientation = 2
      

  3.   

    starheart(张无忌),还有各位能详细些吗?
    孟子提供的我试了,不成功
      

  4.   

    <script language="JavaScript">
    set conexcel = new ActiveXObject("Excel.Application");
    set consheet = conexcel.Worksheets[1];
    consheet.Activate();
    consheet.PageSetup.PaperSize = 9
    consheet.PageSetup.Orientation = 2
    其实,你只要会使用Microsoft Office中的“宏”,跟踪你的操作,即可找到相应的操作,然后“翻译”到你的脚本中即可
    我已经成功解决过,有问题欢迎跟我联系:[email protected]
      

  5.   

    如果生成的excel文档是真正的excel文档而不是显示为excel文档,那么可以先做好一个模版,在模版里设置好页面格式,然后把新的内容输出到该模版,这样就会继承页面设置。这样做的好处是还能设置更多的特性,录入指定表格行标题,使每一页数据都有表头。。
      

  6.   

    可该怎么做模板并输出EXCEL文件让它匹配这个模板呢?brightview(brightview)