资 源 简 介
C# 水晶报表导出各类型文件的例子,将水晶报表数据导出为Word文件、Excel文件、HTML文件、PDF文件,并获取水晶报表的数据库连接项,设置CrystalReport水晶报表的数据库登录选项等。相关的代码片段:
private void button7_Click(object sender, EventArgs e)
{//将水晶报表数据导出为HTML文件
var MyFileName = "MyHTMLFile.htm";
var MyExportOptions = new ExportOptions();
var MyHtml32FormatOptions = new HTMLFormatOptions();
MyExportOptions.ExportFormatType = ExportFormatType.HTML32;
MyHtml32FormatOptions.HTMLBaseFolderName = "Html32Folder";
MyHtml32FormatOptions.HTMLFileName = MyFileName;
MyHtml32FormatOptions.HTMLEnableSeparatedPages = false;
MyHtml32FormatOptions.HTMLHasPageNavigator = false;
MyExportOptions.FormatOptions = MyHtml32FormatOptions;
this.CrystalReport11.Export(MyExportOptions);
MessageBox.Show("成功导出文件:" + MyFileName, "信息提示", MessageBoxButtons.OK);
}
private void button8_Click(object sender, EventArgs e)
{//将水晶报表数据导出为PDF文件
var MyFileName = "MyPDFFile.pdf";
var MyExportOptions = new ExportOptions