FineUI 官方论坛
标题:
打印Grid中内容当数据超过一页的时候表头遮住了部分内容
[打印本页]
作者:
☆_雪枫_☆
时间:
2017-3-29 13:11
标题:
打印Grid中内容当数据超过一页的时候表头遮住了部分内容
在使用window.print();打印Grid中内容的时候,当打印数据超过一页纸的时候,第二页顶部的数据就像是被表头遮住了一样,少了一行记录。代码和效果图如下,请大家帮忙看看是怎么回事
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel111" runat="server" />
<f:Panel ID="Panel111" runat="server" ShowBorder="True" EnableCollapse="false" Layout="VBox" AutoScroll="true"
BoxConfigAlign="Stretch" BoxConfigPosition="Start" ShowHeader="false" Title=" ">
<Items>
<f:Panel ID="Panel15" runat="server" ShowBorder="True" EnableCollapse="false" Layout="VBox"
Width="1165px" BoxConfigAlign="Stretch" BoxConfigPosition="Start" ShowHeader="false"
Title=" ">
<Items>
<f:GroupPanel runat="server" Title="数据报表查询条件" ID="GroupPanel1" EnableCollapse="false"
BodyPadding="5px">
<Items>
<f:SimpleForm ID="SimpleForm3" CssClass="mysimpleform" runat="server" ShowBorder="false"
EnableCollapse="true" Layout="HBox" ShowHeader="false">
<Items>
<f:TextBox ID="tbxMyBox1" Label="当前时间" Width="300px" runat="server" Enabled="false" Margin="0 25 10 0">
</f:TextBox>
<f:DropDownList runat="server" ID="ddlFactory" Width="250px" Label="级别" ShowLabel="true"
Margin="0 25 10 0" AutoPostBack="true" OnSelectedIndexChanged="ddlFactory_SelectedIndexChanged">
</f:DropDownList>
<f:DropDownList runat="server" ID="ddlSelectType" Width="250px" Label="机构" ShowLabel="true"
Margin="0 25 10 0">
</f:DropDownList>
<f:Button runat="server" ID="btnSearch" Text="查找" EnableAjax="false" Margin="0 25 10 0">
</f:Button>
<f:Button ID="btnExport" Text="导出" EnableAjax="false" DisableControlBeforePostBack="false"
OnClick="btnExport_Click" Margin="0 25 10 0" runat="server">
</f:Button>
<f:Button runat="server" ID="btnPrint" Text="打印" EnableAjax="false" OnClientClick="preview();"
Margin="0 25 10 0">
</f:Button>
</Items>
</f:SimpleForm>
</Items>
</f:GroupPanel>
</Items>
</f:Panel>
<f:Grid runat="server" ID="dgvReport" Margin="10 10 10 10" EnableRowLines="true" AllowPaging="false" AllowSorting="true" SortField="UnitName" SortDirection="ASC" Height="600px" ShowBorder="false" ShowHeader="false" ShowGridHeader="true" OnSort="dgvReport_Sort">
<Columns>
<f:BoundField Width="180px" DataField="UnitName" SortField="UnitName" HeaderText="装置" TextAlign="Center" />
<f:BoundField Width="180px" DataField="Description" SortField="Description" HeaderText="回路描述" TextAlign="Center" />
<f:BoundField Width="180px" DataField="LoopName" SortField="LoopName" HeaderText="回路名称" TextAlign="Center" />
<f:BoundField Width="100px" DataField="Mode" SortField="Mode" HeaderText="手自动状态" TextAlign="Center" />
<f:BoundField Width="50px" HeaderText="" TextAlign="Center" />
</Columns>
</f:Grid>
</Items>
</f:Panel>
</form>
<script type="text/javascript">
var dgvReport = '<%= dgvReport.ClientID %>';
function preview() {
var oldstr = document.body.innerHTML;
var dgvReportControl = document.getElementById(dgvReport).innerHTML;
window.document.body.innerHTML = dgvReportControl;
window.print();
document.body.innerHTML = oldstr;
window.location.href = window.location.href;
return;
}
</script>
</body>
</html>
复制代码
[attach]9995[/attach][attach]9996[/attach]
作者:
☆_雪枫_☆
时间:
2017-3-29 14:07
本帖最后由 ☆_雪枫_☆ 于 2017-3-29 16:11 编辑
这个真心找不到原因,求帮助~
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4