【发布时间】:2011-08-19 13:06:00
【问题描述】:
在我的 asp.net 项目中,我需要打印一个包含一些动态内容的页面。我按照这篇文章 http://www.dotnetcurry.com/ShowArticle.aspx?ID=92 来实现这一点,只要我需要打印的内容适合一页,它就可以正常工作。
但是如果内容很长,当我点击打印按钮时,我会看到一个包含所有需要打印的内容的打印预览,打印时它只会打印适合一页的内容。所以我想当我打电话时'window.print()' 它只打印任何可以放入页面的内容,并且不检查是否还有内容要打印在另一个页面上。我不知道如何设置分页符以获取整个内容打印,因为它是动态内容。
有人可以帮我解决这个问题吗?
谢谢
编辑:
这是一些呈现的示例 HTML。
<table class="Main">
<tr>
<td class=”left bold”>
Some text
</td>
<td>
<span id="Label">Label</span>
</td>
</tr>
<tr>
......
......
</tr>
......
......
......
<tr>
<td>
<table class= “productslist”>
<tbody>
<tr>....</tr>
<tr>....</tr>
<tr class=”productTextAlign”> ......</tr>
<tr class=”additionalOptions”> ..... </tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr>...</tr>
<tr class=”productTextAlign”></tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
</tbody>
</table>
</td>
<tr>
</table>
类为“Main”的表是一个 html 表,其中还有另一个类为“productslist”的表,它实际上是一个中继器。我正在尝试使用
将“分页符之前”应用于此转发器table.productslist
{
page-break-before:auto;
}
在 FF6.0 中不起作用,在 IE8 中似乎可以正常工作。
【问题讨论】:
-
FF6 还是新的,可能有很多错误。
-
你认为它会在较低版本的 FF 中工作吗?
-
你没试过吗???
-
我还没有。会试一试。谢谢
-
只是为了确认'page-break-before'设置为'auto'时,对于冗长的内容,它会引入分页符。对吗?