怎么将导出excel、pdf、打印等按钮添加到工具栏上
怎么将导出excel、pdf、打印等按钮添加到工具栏上????????? 您好,您使用得AR是哪个版本的?工具栏是winForm还是WPF下的工具栏? 回复 2楼frank.zhang的帖子
webform 9.0版本。。打印pdf的时候可以选择纸张的大小? 您好,
导出excel、pdf解决的思路是自定义一个button,然后添加到Toolbar上。在这个button上增加一个点击触发的方法。在这个方法里面实现导出。
//Add a new button to the end of the tool strip with the caption "Print."
ToolStripButton tsbPrint = new ToolStripButton("Print");
viewer1.Toolbar.ToolStrip.Items.Add(tsbPrint);
//Create a click event handler for the button.
tsbPrint.Click += new EventHandler(tsbPrint_Click);
//Call the custom dialog from the new button's click event.
private void tsbPrint_Click(object sender, EventArgs e)
{
this.CustomPrint();
}
//Call the custom print dialog.
private void CustomPrint()
{
frmPrintDlg _printForm = new frmPrintDlg();
_printForm.ShowDialog(this);
}
导出excel代码参考
// Provide the page report you want to render.
GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(@"C:\Sample_PageReport.rdlx"));
GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);
// Create an output directory
System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyExcel");
outputDirectory.Create();
// Provide settings for your rendering output.
GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings excelSetting = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings();
excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xls;
GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = excelSetting;
//Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension excelRenderingExtension = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
reportDocument.Render(excelRenderingExtension, outputProvider, excelSetting.GetSettings());
您好,
距离这个问题的最后回复已经过去了一段时间,不知道这个问题您是否已经解决?
如果没有解决,欢迎跟贴接续讨论,如果已经解决请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页:
[1]