怎样进行打印(急急急急急急急急!)顶者有分 使用ReportViewer或CrystalReportViewer控件~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你个方案:1、从数据库取得数据2、将数据保存到Excel文件中。3、打印Excel文件。你所要求的表头、表尾的固定内容需求,在Excel中非常容易实现,也方便你修改客户的其他需求。 http://www.webmis.com.cn/webmis_cs.htm有人专做打印的,看下长江支流的博客http://blog.csdn.net/flygoldfish/archive/2006/03/13/623115.aspx GridLineFlag是啥,它的命名空间是啥 用水晶报表,或者把它导入到excel再打印 上面有位给的是MIS快速开发的源码,这个才是打印,包含Excel及模板打印http://www.webmis.com.cn/misgoldprinter.htm Protected Function CreateRpts(ByVal ReportID As String, _ ByVal cQuery As clsQuery, ByVal fileName As String, _ ByVal fileType As ReportFileType, _ ByVal cnString As String) As String Implements iABMRpts.CreateRpts ' ' generate the excel file ' Dim CD As New APLNetShared2.clsSQLData(cnString) Dim cPB As New APLNetShared2.clsDataParameterListBuilder Dim ds As New System.Data.DataSet Dim xlApp As New Microsoft.Office.Interop.Excel.Application Dim bk As Microsoft.Office.Interop.Excel.Workbook Dim sh As Microsoft.Office.Interop.Excel.Worksheet Dim nRow As Integer Dim sSQL As New System.Text.StringBuilder bk = xlApp.Workbooks.Add sh = bk.Worksheets(1) nRow = 1 'sSQL = " SELECT Policy.SocialSecurityNo,PolicyHolder.FirstName ,PolicyHolder.LastName," & _ '"billingInfo.type,paymentmethod.paymentmethod,policy.policystatus,Policy.NewBusinessPeriod," & _ '"policy.premium6,Policy.NextBillAmount,Policy.RenewalPeriod,Policy.NextBillDate,Policy.Premium2," & _ '"Policy.RenewalPeriod,MAX(TransactionHistory.TransactionDate) as TransactionDate,PolicyHolder.LastName,Policy.Active" & _ '"FROM policy ,PolicyHolder TransactionHistory,billingInfo,paymentmethod " & _ '"WHERE Policy.SocialSecurityNo = PolicyHolder.SocialSecurityNo AND Policy.PolicyNo = TransactionHistory.SourceFile " sSQL.Append("SELECT Policy.SocialSecurityNo,") sSQL.Append(" PolicyHolder.FirstName+' '+PolicyHolder.LastName AS FullName,") sSQL.Append(" BillingInfo.Type, PaymentMethod.PaymentMethod, Policy.PolicyStatus,") sSQL.Append(" Policy.NewBusinessPeriod, Policy.Premium6, Policy.NextBillAmount,") sSQL.Append(" Policy.RenewalPeriod, Policy.NextBillDate, Policy.Premium2,") sSQL.Append(" MAX(TransactionHistory.TransactionDate) AS MaxTransactionDate,") sSQL.Append(" PolicyHolder.LastName, Policy.Active") sSQL.Append(" FROM Policy") sSQL.Append(" LEFT JOIN PolicyHolder ON Policy.SocialSecurityNo=PolicyHolder.SocialSecurityNo") sSQL.Append(" LEFT JOIN TransactionHistory ON Policy.PolicyNo=TransactionHistory.SourceFile") sSQL.Append(" LEFT JOIN BillingInfo on Policy.RecordID=BillingInfo.PolicyID") sSQL.Append(" LEFT JOIN PaymentMethod ON Policy.PaymentMethodID=PaymentMethod.RecordID") cQuery.CreateQueryString() If cQuery.QueryString.Trim.Length > 0 Then sSQL.Append(" WHERE " & cQuery.CreateQueryString) cPB = cQuery.ParameterBuilder End If sSQL.Append(" GROUP BY") sSQL.Append(" Policy.SocialSecurityNo, PolicyHolder.FirstName, PolicyHolder.LastName,") sSQL.Append(" BillingInfo.Type, PaymentMethod.PaymentMethod, Policy.PolicyStatus,") sSQL.Append(" Policy.NewBusinessPeriod, Policy.Premium6, Policy.NextBillAmount,") sSQL.Append(" Policy.RenewalPeriod, Policy.NextBillDate, Policy.Premium2, Policy.Active") ds = CD.ExecDataSet(sSQL.ToString, cPB.ParameterList) sh.Range("A" & nRow).Value = "ID" sh.Range("B" & nRow).Value = "FULL_NAME" sh.Range("C" & nRow).Value = "MEMBER_TYPE" sh.Range("D" & nRow).Value = "CATEGORY" sh.Range("E" & nRow).Value = "STATUS" sh.Range("F" & nRow).Value = "JOIN_DATE" sh.Range("G" & nRow).Value = "OVER_UNDER_PAY" sh.Range("H" & nRow).Value = "AMOUNT" sh.Range("I" & nRow).Value = "PAID_THRU" sh.Range("J" & nRow).Value = "BILL_DATE" sh.Range("K" & nRow).Value = "BILL_FLAG" sh.Range("L" & nRow).Value = "BILL_DAY" sh.Range("M" & nRow).Value = "DUES_AMOUNT" sh.Range("N" & nRow).Value = "PAID_TILL" sh.Range("O" & nRow).Value = "LAST_DEBITED" sh.Range("P" & nRow).Value = "LAST_NAME" sh.Range("Q" & nRow).Value = "DIRECT_DEBIT" sh.Range("R" & nRow).Value = "ACTIVE" If ds.Tables(0).Rows.Count > 0 Then For Each row As System.Data.DataRow In ds.Tables(0).Rows nRow += 1 sh.Range("A" & nRow).Value = row("SocialSecurityNo") sh.Range("B" & nRow).Value = row("FullName") sh.Range("C" & nRow).Value = row("Type") sh.Range("D" & nRow).Value = row("PaymentMethod") sh.Range("E" & nRow).Value = row("PolicyStatus") sh.Range("F" & nRow).Value = row("NewBusinessPeriod") sh.Range("G" & nRow).Value = row("Premium6") sh.Range("H" & nRow).Value = row("NextBillAmount") sh.Range("I" & nRow).Value = row("RenewalPeriod") sh.Range("J" & nRow).Value = row("NextBillDate") sh.Range("K" & nRow).Value = "" sh.Range("L" & nRow).Value = "" sh.Range("M" & nRow).Value = row("Premium2") sh.Range("N" & nRow).Value = row("RenewalPeriod") sh.Range("O" & nRow).Value = row("MaxTransactionDate") sh.Range("P" & nRow).Value = row("LastName") sh.Range("Q" & nRow).Value = row("Active") sh.Range("R" & nRow).Value = row("Active") Next End If bk.SaveAs(fileName) bk.Close(False) xlApp = Nothing Return "Success" End Function 其中SQL语句和查询字段可以更改 我在vs2005下做的,希望对你能有所帮助 水晶报表有时间限制吗?在VisualStudio2005EXPRESS中。 水晶报表有时间限制吗?在VisualStudio2005EXPRESS中。ReportView有时间限制吗? using System;using System.Drawing;namespace GoldPrinter{ /// <summary> /// MultiHeader,多层表头 /// /// 作 者:长江支流(周方勇) /// Email:[email protected] QQ:150439795 /// 网 址:www.webmis.com.cn /// ★★★★★您可以免费使用此程序,但是请您完整保留此说明,以维护知识产权★★★★★ /// /// </summary> public class MultiHeader:Header { private const int CONST_MAX_ROWS = 3; public MultiHeader() { // this.IsDrawAllPage = true; mdrawGrid.AlignMent = AlignFlag.Center; mdrawGrid.Border = GridBorderFlag.SingleBold; mdrawGrid.Line = GridLineFlag.Both; //粗体显示并合并 mdrawGrid.Merge = GridMergeFlag.Any; this.Font = new Font("宋体",12,FontStyle.Bold); mdrawGrid.RowHeight = this.Font.Height + 10; } protected override int SetMaxRows() { return CONST_MAX_ROWS; } public MultiHeader(int rows,int cols):this() { base.Initialize(rows,cols); string mstrAlignment = ""; //所有列居中对齐 for(int i = 0 ; i < cols ; i++) { mstrAlignment += "C"; } this.mdrawGrid.ColsAlignString = mstrAlignment; } public string ColsAlign { get { return this.mdrawGrid.ColsAlignString; } set { this.mdrawGrid.ColsAlignString = value; } } public int[] ColsWidth { get { return this.mdrawGrid.ColsWidth; } set { this.mdrawGrid.ColsWidth = value; } } }//End Class}//End NameSpace http://www.microsoft.com/china/msdn/events/webcasts/shared/webcast/episode.aspx?newsID=1242519下载代码,几种方法均可. VSTS是什么? 这是为什么呢? 【Discuz!NT】3.9.913版本的源代码在哪里下载? 修改密码问题? 获得文件 问一个问题关于window.showModalDialog的resizeTo的问题. 如何設計Asp.net界面,請參看我的一個頁面( bbs.dgpub.org) 关于水晶报表问题...急..在线等 DataReader的问题!!急!急!有代码 有否兄弟做过在DataGrid上绑定dropdownlist控件和多重radio button? WEB 控件TextBox 滚动条颜色怎么调,还在page 滚动条颜色怎么调??? 分页数据显示,大家都是如何处理的?
1、从数据库取得数据
2、将数据保存到Excel文件中。
3、打印Excel文件。你所要求的表头、表尾的固定内容需求,在Excel中非常容易实现,也方便你修改客户的其他需求。
有人专做打印的,看下长江支流的博客
http://blog.csdn.net/flygoldfish/archive/2006/03/13/623115.aspx
http://www.webmis.com.cn/misgoldprinter.htm
ByVal cQuery As clsQuery, ByVal fileName As String, _
ByVal fileType As ReportFileType, _
ByVal cnString As String) As String Implements iABMRpts.CreateRpts
'
' generate the excel file
'
Dim CD As New APLNetShared2.clsSQLData(cnString)
Dim cPB As New APLNetShared2.clsDataParameterListBuilder
Dim ds As New System.Data.DataSet
Dim xlApp As New Microsoft.Office.Interop.Excel.Application
Dim bk As Microsoft.Office.Interop.Excel.Workbook
Dim sh As Microsoft.Office.Interop.Excel.Worksheet
Dim nRow As Integer
Dim sSQL As New System.Text.StringBuilder bk = xlApp.Workbooks.Add
sh = bk.Worksheets(1)
nRow = 1
'sSQL = " SELECT Policy.SocialSecurityNo,PolicyHolder.FirstName ,PolicyHolder.LastName," & _
'"billingInfo.type,paymentmethod.paymentmethod,policy.policystatus,Policy.NewBusinessPeriod," & _
'"policy.premium6,Policy.NextBillAmount,Policy.RenewalPeriod,Policy.NextBillDate,Policy.Premium2," & _
'"Policy.RenewalPeriod,MAX(TransactionHistory.TransactionDate) as TransactionDate,PolicyHolder.LastName,Policy.Active" & _
'"FROM policy ,PolicyHolder TransactionHistory,billingInfo,paymentmethod " & _
'"WHERE Policy.SocialSecurityNo = PolicyHolder.SocialSecurityNo AND Policy.PolicyNo = TransactionHistory.SourceFile " sSQL.Append("SELECT Policy.SocialSecurityNo,")
sSQL.Append(" PolicyHolder.FirstName+' '+PolicyHolder.LastName AS FullName,")
sSQL.Append(" BillingInfo.Type, PaymentMethod.PaymentMethod, Policy.PolicyStatus,")
sSQL.Append(" Policy.NewBusinessPeriod, Policy.Premium6, Policy.NextBillAmount,")
sSQL.Append(" Policy.RenewalPeriod, Policy.NextBillDate, Policy.Premium2,")
sSQL.Append(" MAX(TransactionHistory.TransactionDate) AS MaxTransactionDate,")
sSQL.Append(" PolicyHolder.LastName, Policy.Active")
sSQL.Append(" FROM Policy")
sSQL.Append(" LEFT JOIN PolicyHolder ON Policy.SocialSecurityNo=PolicyHolder.SocialSecurityNo")
sSQL.Append(" LEFT JOIN TransactionHistory ON Policy.PolicyNo=TransactionHistory.SourceFile")
sSQL.Append(" LEFT JOIN BillingInfo on Policy.RecordID=BillingInfo.PolicyID")
sSQL.Append(" LEFT JOIN PaymentMethod ON Policy.PaymentMethodID=PaymentMethod.RecordID") cQuery.CreateQueryString()
If cQuery.QueryString.Trim.Length > 0 Then
sSQL.Append(" WHERE " & cQuery.CreateQueryString)
cPB = cQuery.ParameterBuilder
End If sSQL.Append(" GROUP BY")
sSQL.Append(" Policy.SocialSecurityNo, PolicyHolder.FirstName, PolicyHolder.LastName,")
sSQL.Append(" BillingInfo.Type, PaymentMethod.PaymentMethod, Policy.PolicyStatus,")
sSQL.Append(" Policy.NewBusinessPeriod, Policy.Premium6, Policy.NextBillAmount,")
sSQL.Append(" Policy.RenewalPeriod, Policy.NextBillDate, Policy.Premium2, Policy.Active") ds = CD.ExecDataSet(sSQL.ToString, cPB.ParameterList) sh.Range("A" & nRow).Value = "ID"
sh.Range("B" & nRow).Value = "FULL_NAME"
sh.Range("C" & nRow).Value = "MEMBER_TYPE"
sh.Range("D" & nRow).Value = "CATEGORY"
sh.Range("E" & nRow).Value = "STATUS"
sh.Range("F" & nRow).Value = "JOIN_DATE"
sh.Range("G" & nRow).Value = "OVER_UNDER_PAY"
sh.Range("H" & nRow).Value = "AMOUNT"
sh.Range("I" & nRow).Value = "PAID_THRU"
sh.Range("J" & nRow).Value = "BILL_DATE"
sh.Range("K" & nRow).Value = "BILL_FLAG"
sh.Range("L" & nRow).Value = "BILL_DAY"
sh.Range("M" & nRow).Value = "DUES_AMOUNT"
sh.Range("N" & nRow).Value = "PAID_TILL"
sh.Range("O" & nRow).Value = "LAST_DEBITED"
sh.Range("P" & nRow).Value = "LAST_NAME"
sh.Range("Q" & nRow).Value = "DIRECT_DEBIT"
sh.Range("R" & nRow).Value = "ACTIVE" If ds.Tables(0).Rows.Count > 0 Then
For Each row As System.Data.DataRow In ds.Tables(0).Rows
nRow += 1
sh.Range("A" & nRow).Value = row("SocialSecurityNo")
sh.Range("B" & nRow).Value = row("FullName")
sh.Range("C" & nRow).Value = row("Type")
sh.Range("D" & nRow).Value = row("PaymentMethod")
sh.Range("E" & nRow).Value = row("PolicyStatus")
sh.Range("F" & nRow).Value = row("NewBusinessPeriod")
sh.Range("G" & nRow).Value = row("Premium6")
sh.Range("H" & nRow).Value = row("NextBillAmount")
sh.Range("I" & nRow).Value = row("RenewalPeriod")
sh.Range("J" & nRow).Value = row("NextBillDate")
sh.Range("K" & nRow).Value = ""
sh.Range("L" & nRow).Value = ""
sh.Range("M" & nRow).Value = row("Premium2")
sh.Range("N" & nRow).Value = row("RenewalPeriod")
sh.Range("O" & nRow).Value = row("MaxTransactionDate")
sh.Range("P" & nRow).Value = row("LastName")
sh.Range("Q" & nRow).Value = row("Active")
sh.Range("R" & nRow).Value = row("Active")
Next
End If bk.SaveAs(fileName) bk.Close(False)
xlApp = Nothing Return "Success" End Function
在VisualStudio2005EXPRESS中。
在VisualStudio2005EXPRESS中。ReportView有时间限制吗?
using System.Drawing;namespace GoldPrinter
{
/// <summary>
/// MultiHeader,多层表头
///
/// 作 者:长江支流(周方勇)
/// Email:[email protected] QQ:150439795
/// 网 址:www.webmis.com.cn
/// ★★★★★您可以免费使用此程序,但是请您完整保留此说明,以维护知识产权★★★★★
///
/// </summary>
public class MultiHeader:Header
{
private const int CONST_MAX_ROWS = 3; public MultiHeader()
{
// this.IsDrawAllPage = true;
mdrawGrid.AlignMent = AlignFlag.Center;
mdrawGrid.Border = GridBorderFlag.SingleBold;
mdrawGrid.Line = GridLineFlag.Both;
//粗体显示并合并
mdrawGrid.Merge = GridMergeFlag.Any;
this.Font = new Font("宋体",12,FontStyle.Bold);
mdrawGrid.RowHeight = this.Font.Height + 10;
} protected override int SetMaxRows()
{
return CONST_MAX_ROWS;
} public MultiHeader(int rows,int cols):this()
{
base.Initialize(rows,cols); string mstrAlignment = ""; //所有列居中对齐
for(int i = 0 ; i < cols ; i++)
{
mstrAlignment += "C";
}
this.mdrawGrid.ColsAlignString = mstrAlignment;
} public string ColsAlign
{
get
{
return this.mdrawGrid.ColsAlignString;
}
set
{
this.mdrawGrid.ColsAlignString = value;
}
} public int[] ColsWidth
{
get
{
return this.mdrawGrid.ColsWidth;
}
set
{
this.mdrawGrid.ColsWidth = value;
}
} }//End Class
}//End NameSpace