求高人指点,打印的问题?

uestctg 2010-05-26 01:08:31
想把录入在<table>内表单的内容在进入数据的同时打印出来,如何实施,请高人指点。部分代码如下:

准备把<table>内的内容打印。

<body style="background-color: #ffffff">

<form id="form1" runat="server">
<div style="text-align: center">
<span style="font-size: 14pt"><strong>收费管理</strong></span><br />
<table border=1>
<tr>
<td colspan="2" style="width: 846px; height: 11px">
IC卡号  <asp:TextBox ID="TextBox1" runat="server" Width="86px" AutoPostBack="true" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
<asp:Label ID="Label2" runat="server"  ForeColor="red" ></asp:Label>车号<asp:TextBox ID="TextBox2" runat="server" Width="69px" ></asp:TextBox>
驾校<asp:TextBox ID="TextBox9" runat="server" Width="87px"></asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="school_name" DataValueField="school_name" Width="104px">
</asp:DropDownList>
项目<asp:TextBox ID="TextBox10" runat="server" ReadOnly="True" Width="121px"></asp:TextBox>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true" DataTextField="project_name" DataValueField="project_funds" Width="122px" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged">
</asp:DropDownList>价格<asp:TextBox ID="TextBox3" runat="server" Width="35px" AutoPostBack="True" ReadOnly="True"></asp:TextBox>元/小时</td>
<td rowspan="1" style="width: 59px">
</td>
</tr>
<tr>
<td colspan="2" style="width: 846px; height: 11px">
开始时间<asp:TextBox ID="TextBox5" runat="server" Width="117px" ReadOnly="True"></asp:TextBox>
结束结束<asp:TextBox ID="TextBox4" runat="server" Width="111px" ReadOnly="True"></asp:TextBox>
预用时<asp:TextBox
ID="TextBox12" runat="server"
Width="23px" AutoPostBack="True" OnTextChanged="TextBox12_TextChanged"></asp:TextBox>
<asp:Label ID="Label1" runat="server"></asp:Label>
小时   押金<asp:TextBox
ID="TextBox13" runat="server" Width="45px" ></asp:TextBox>元
<asp:Label ID="Label3" runat="server" BackColor="#C00000" BorderColor="White" Text="退押金"></asp:Label><asp:TextBox
ID="TextBox14" runat="server" Width="41px"></asp:TextBox></td>
<td style="width: 59px" rowspan="2">
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="确定" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="增加" /></td></tr><tr>
<td colspan="2" style="width: 846px; height: 28px;">
实际用时<asp:TextBox ID="TextBox6" runat="server" Width="131px" ReadOnly="True"></asp:TextBox>
费用<asp:TextBox
ID="TextBox7" runat="server" Width="89px"></asp:TextBox>元  实际收费<asp:TextBox ID="TextBox8"
runat="server" Width="85px"></asp:TextBox>
元 收费人<asp:TextBox ID="TextBox11" runat="server"
Width="103px"></asp:TextBox></td>
</tr></table>
<asp:GridView ID="GridView1" runat="server"

加入按钮后如何实施代码编写。
急啊
...全文
84 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
yswenli 2010-05-26
  • 打赏
  • 举报
回复
web页面打印可用window.print()js方法

1.若你的这个内容是整面则可以直接加入<input type=buttom onclick="this.style.display='none';window.print();" value="打印" />
2.若你的页面内容是其中的一部分,则可以<input type="buttom" onclick="window.open(A.html)" value="打印">;a.html页面内容与打印相同,然后再在a.html页面中加入<script type="text/javascript">window.print();</script>
  • 打赏
  • 举报
回复
3楼的可以,不过我通常都是弄个打印预览的功能,弹出一个窗体然后打印的
limii 2010-05-26
  • 打赏
  • 举报
回复
up...
ksy 2010-05-26
  • 打赏
  • 举报
回复
参考以下代码:
<html>
<head>
<style media="print">
.noprint /*使用此样式的元素打印时不出现*/
{
display: none;
}
</style>

<script type="text/javascript">
function printDoc() {
window.print();
}
</script>

</head>
<body>
<table>
<tr>
<td>
hello!
</td>
</tr>
</table>
<button onclick="printDoc();" class="noprint">
打印</button>
</body>
</html>
uestctg 2010-05-26
  • 打赏
  • 举报
回复
想把录入在<table>内表单的内容在进入数据的同时打印出来,如何实施,请高人指点。部分代码如下:

准备把<table>内的内容打印。

<body style="background-color: #ffffff">

<form id="form1" runat="server">
<div style="text-align: center">
<span style="font-size: 14pt"><strong>收费管理</strong></span><br />
<table border=1>
<tr>
<td>驾校<asp:TextBox ID="TextBox9" runat="server" Width="87px"></asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="school_name" DataValueField="school_name" Width="104px">
</asp:DropDownList>
项目
</td>
</tr>
<tr>
<td colspan="2" style="width: 846px; height: 11px">
开始时间<asp:TextBox ID="TextBox5" runat="server" Width="117px" ReadOnly="True"></asp:TextBox>
结束结束<asp:TextBox ID="TextBox4" runat="server" Width="111px" ReadOnly="True"></asp:TextBox>
<td>
</tr>
<table>
<asp:GridView ID="GridView1" runat="server"

加入按钮后如何实施代码编写。
xiaodru 2010-05-26
  • 打赏
  • 举报
回复
用。net内部接口 microsoft.office.tools.word 使用word打印就行了 打印出来的就是相当于word文档咯 当然用excel也行 microsoft.office.tools.excel

111,125

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧