C#打印和打印预览datatable中的数据 我搜索出来的全部数据赋值给DataTable,然后我想把datatable中的全部数据打印出来(点打印按钮先出来打印预览对话框),然后再点击打印就打印了(最好要是能够打印多页数据,并且可以传递一个标题),因为打印需要一个标题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 简单一点的报表控件Active Report等 使用GDI+自己画我就是这么搞的·~~PS:不要认为打印很难,但是打印控制的确不是很简单·~~你的寥寥几句话实现起来其实很麻烦(如果是用GDI+的话),涉及到换行,分页这些,字体大小这些~~~但是如果用水晶报表,那就简单太多了· 使用printdocument可实现分页打开 打印机器是不会分页的,可以利用css样式分页 帮你找找代码 。。 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!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> <mce:style type="text/css" media="print,screen"><!-- th { font-family: Arial; color: black; background-color: lightgrey; } thead { display: table-header-group; } tbody { display: table-row-group; } --></mce:style><style type="text/css" media="print,screen" mce_bogus="1"> th { font-family: Arial; color: black; background-color: lightgrey; } thead { display: table-header-group; } tbody { display: table-row-group; } </style> </head> <body style="text-align: center;" mce_style="text-align: center;"> <form id="form1" runat="server"> <div style="width: 100%; text-align: center;"> <table> <tr> <th> 就第一页有 </th> <th> First Name </th> <th> Last Name </th> </tr> <tr> <th> 就第一页有 </th> <th> First Name </th> <th> Last Name </th> </tr> </table> <table border="1" cellpadding="2" cellspacing="0"> <thead> <tr> <th> ID </th> <th> First Name </th> <th> Last Name </th> </tr> </thead> <tbody> <cfoutput query = "query_name" group = "query_column" > <cfloop from="1" to="50" index="11" > <tbody id="ttable" runat="server"> </tbody> </cfloop> </cfoutput> </tbody> </table> </div> </form> </body> </html> 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/guoyz_1/archive/2009/10/27/4732980.aspxpublic partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { for (int i = 0; i < 200; i++) { ttable.InnerHtml += "<tr><td>#"+i.ToString()+"#</td><td>First Name #i#</td><td>Last Name #i#</td></tr>"; } } } } 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/guoyz_1/archive/2009/10/27/4732980.aspx [email protected] 呵呵给我一个谢谢 群主也给我一份,急需,邮箱[email protected].谢谢。 如何设置子线程可以随着主线程的结束而结束? ORACLE存储过程怎么执行? c#多线程如何锁定com组件 对于C# 构造函数的问题? 我想用c#三层结构的oa换c#三层结构的全站程序学习。 我自己用C#的SOCKET写了个TCP网络控件,已经传上去了,不知道发布了没! 请问我重写方法为什么没值出来呢 访问内网另一机器的SQL,输入机器名可以,输入IP却无效~~~ C# winfrom 使用透明gif图片做等待提示框,窗体背景无法透明的问题 做一个合格的开发小组长都需要掌握什么呢? 关于电影售票系统的数据库设计 C#读Serialport COM1 异常
你的寥寥几句话实现起来其实很麻烦(如果是用GDI+的话),涉及到换行,分页这些,字体大小这些~~~
但是如果用水晶报表,那就简单太多了·
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
<mce:style type="text/css" media="print,screen"><!--
th
{
font-family: Arial;
color: black;
background-color: lightgrey;
}
thead
{
display: table-header-group;
}
tbody
{
display: table-row-group;
}
--></mce:style><style type="text/css" media="print,screen" mce_bogus="1"> th
{
font-family: Arial;
color: black;
background-color: lightgrey;
}
thead
{
display: table-header-group;
}
tbody
{
display: table-row-group;
}
</style>
</head>
<body style="text-align: center;" mce_style="text-align: center;">
<form id="form1" runat="server">
<div style="width: 100%; text-align: center;">
<table>
<tr>
<th>
就第一页有
</th>
<th>
First Name
</th>
<th>
Last Name
</th>
</tr>
<tr>
<th>
就第一页有
</th>
<th>
First Name
</th>
<th>
Last Name
</th>
</tr>
</table>
<table border="1" cellpadding="2" cellspacing="0">
<thead>
<tr>
<th>
ID
</th>
<th>
First Name
</th>
<th>
Last Name
</th>
</tr>
</thead>
<tbody>
<cfoutput query = "query_name" group = "query_column" >
<cfloop from="1" to="50" index="11" >
<tbody id="ttable" runat="server">
</tbody>
</cfloop>
</cfoutput>
</tbody>
</table>
</div>
</form>
</body>
</html>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/guoyz_1/archive/2009/10/27/4732980.aspxpublic partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
for (int i = 0; i < 200; i++)
{
ttable.InnerHtml += "<tr><td>#"+i.ToString()+"#</td><td>First Name #i#</td><td>Last Name #i#</td></tr>";
}
}
}
} 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/guoyz_1/archive/2009/10/27/4732980.aspx