c# winform 报表打印

来源:百度知道 编辑:UC知道 时间:2024/05/17 07:04:07
c#开发winform系统,怎么做报表、表单的打印。
比较简单点的 用户可以自己设置打印表单的样式。

看到过fastreport这个的,但是这个在c#中集成不上。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ToExcelDemo
{
class ExportExcel
{
public static void ExportToExcel(System.Windows.Forms.DataGridView grdView)
{
int rowCount = grdView.Rows.Count;
int columnCount = grdView.Columns.Count;
if (rowCount == 0)
{
System.Windows.Forms.MessageBox.Show("没有数据可供导出...", "Prompt", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
return;
}
System.Windows.Forms.SaveFileDialog saveDlg = new System.Windows.Forms.SaveFileDialog();
saveDlg.Title = "导出文件保存路径";
saveDlg.Filter = "Excel files(*.xls)|*.xls";
saveDlg.FilterIndex = 0;
saveDlg.Resto