回复 2楼enson100的帖子
你好,根据当前信息无法确认问题所在。
需要设置 PrinterName 为空(为空时选择虚拟打印机)请尝试以下代码:
- private void Form1_Load(object sender, EventArgs e)
- {
- DataSet ds = new DataSet();
- DataTable dt = new DataTable("AccountInfo");
- DataColumn col1 = new DataColumn("username");
- dt.Columns.Add(col1);
- dt.Rows.Add("iceman");
- dt.Rows.Add("luca");
- ds.Tables.Add(dt);
- DailyOrMonthlyReport dailyReport = new DailyOrMonthlyReport();
- dailyReport.DataSource = ds;
- dailyReport.DataMember = "AccountInfo";
- dailyReport.Run();
- this.viewer1.Document.Printer.PrinterName = "";
- this.viewer1.Document = dailyReport.Document;
- }
- private void printPDFToolStripMenuItem_Click(object sender, EventArgs e)
- {
- GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport pdfExport = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
- pdfExport.Export(this.viewer1.Document, @"E:\111.pdf");
- }
复制代码 |