C#打印DataGrid中的数据[转贴]
2006-04-20 13:35
288 查看
function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}
C#打印DataGrid中的数据[转贴]
document.title="C#打印DataGrid中的数据[转贴] - "+document.title
对于信息系统,打印功能是必须的。而打印,是一件相当麻烦的事情。打印DataGrid中的数据,尤其如此。要想到的很多,包括页眉、页脚设置,打印字体,分页,标题,预览等等一系列问题。如果从头写,工作量实在太大。网络上有很多C#写的打印DataGrid类代码,我几乎挨个尝试了个遍,要么就是不能正常使用,要么就是丢失数据,最后在打算自己写一个简单的时候,突然想起了机器上安装的Developer.Express.NET.Windows.Forms.Components.Suite控件。到工具栏里一看,果然有几个打印控件。再找些该控件的相关资料,很容易就搞定了打印DataGrid的功能。下面是两个函数,一个是直接打印,一个是打印预览。实现的效果非常的好。
public void Print(DataGrid dataGrid1)
{
DevExpress.XtraPrinting.PrintingSystem ps=new DevExpress.XtraPrinting.PrintingSystem();
DevExpress.XtraPrintingLinks.DataGridLink printlink=new DevExpress.XtraPrintingLinks.DataGridLink();
System.Windows.Forms.Cursor currentCursor=Cursor.Current;
Cursor.Current=System.Windows.Forms.Cursors.WaitCursor;
printlink.DataGrid=dataGrid1;
printlink.CreateDocument(ps);
ps.PrintDlg();
}
public void PrintReview(DataGrid dataGrid1)
{
DevExpress.XtraPrinting.PrintingSystem ps=new DevExpress.XtraPrinting.PrintingSystem();
DevExpress.XtraPrintingLinks.DataGridLink printlink=new DevExpress.XtraPrintingLinks.DataGridLink();
System.Windows.Forms.Cursor currentCursor=Cursor.Current;
Cursor.Current=System.Windows.Forms.Cursors.WaitCursor;
printlink.DataGrid=dataGrid1;
printlink.CreateDocument(ps);
ps.PreviewForm.Show();
Cursor.Current=currentCursor;
}
C#打印DataGrid中的数据[转贴]
document.title="C#打印DataGrid中的数据[转贴] - "+document.title
对于信息系统,打印功能是必须的。而打印,是一件相当麻烦的事情。打印DataGrid中的数据,尤其如此。要想到的很多,包括页眉、页脚设置,打印字体,分页,标题,预览等等一系列问题。如果从头写,工作量实在太大。网络上有很多C#写的打印DataGrid类代码,我几乎挨个尝试了个遍,要么就是不能正常使用,要么就是丢失数据,最后在打算自己写一个简单的时候,突然想起了机器上安装的Developer.Express.NET.Windows.Forms.Components.Suite控件。到工具栏里一看,果然有几个打印控件。再找些该控件的相关资料,很容易就搞定了打印DataGrid的功能。下面是两个函数,一个是直接打印,一个是打印预览。实现的效果非常的好。
public void Print(DataGrid dataGrid1)
{
DevExpress.XtraPrinting.PrintingSystem ps=new DevExpress.XtraPrinting.PrintingSystem();
DevExpress.XtraPrintingLinks.DataGridLink printlink=new DevExpress.XtraPrintingLinks.DataGridLink();
System.Windows.Forms.Cursor currentCursor=Cursor.Current;
Cursor.Current=System.Windows.Forms.Cursors.WaitCursor;
printlink.DataGrid=dataGrid1;
printlink.CreateDocument(ps);
ps.PrintDlg();
}
public void PrintReview(DataGrid dataGrid1)
{
DevExpress.XtraPrinting.PrintingSystem ps=new DevExpress.XtraPrinting.PrintingSystem();
DevExpress.XtraPrintingLinks.DataGridLink printlink=new DevExpress.XtraPrintingLinks.DataGridLink();
System.Windows.Forms.Cursor currentCursor=Cursor.Current;
Cursor.Current=System.Windows.Forms.Cursors.WaitCursor;
printlink.DataGrid=dataGrid1;
printlink.CreateDocument(ps);
ps.PreviewForm.Show();
Cursor.Current=currentCursor;
}
相关文章推荐
- C#打印DataGrid中的数据[转贴]
- C#打印DataGrid中的数据
- C#打印条型码生成源程序[转贴]
- C# 打印DataTable 修正版 适应宽度超出一页 数据量超出一页的情况
- 在C#里实现DATAGRID的打印预览和打印
- C#中DataGrid加载XML数据--管理 传值到例外个页面 再传值
- 开源:VS.NET打印思想与2003/5DataGrid、DataGridView及二维数据如ListView等终极打印实现(转)
- 将DataGrid中的数据转换为Excel(c#)
- [转贴]通过 C# 使用 J# 类库中的 Zip 类压缩文件和数据
- C#各种数据类型转json字符串(转贴)
- C#2.0 print winform 打印窗体数据试试
- 在C#里实现DATAGRID的打印预览和打印
- C# word打印文档打印不全(数据为完全发送至打印机,程序已经退出)
- 开源:VS.NET打印思想与2003/5DataGrid、DataGridView及二维数据如ListView等终极打印实现
- [转贴]vb.net2003中,利用datagrid更新数据
- 利用ASP.NET DataGrid显示主次关系的数据(c#版)
- C#中DataGrid加载XML数据---上移和下移
- asp.net(c#)打印excel大数据量,最简单,最快的办法,个人认为,哈哈,有人会说,用gridview打印excel不是很方便吗?但是我发现数据量一大gridview就不行,速度慢不说,还会出错
- c#大圣之路笔记——c# 从DataGrid中导出数据 Session
- VS.NET打印思想与2003/5DataGrid、DataGridView及二维数据如ListView等终极打印实现