Some operations of crystal reports

xiaoxiao2021-03-06  14

// Two important namespaces

Using crystaldecisions.shared; // Responsible for explaining using crystaldecisions.crystalReports.Engine, etc. of the TableLogonInfo class; // Responsible for explaining the ReportDocument class, etc.

// Crystal Report Modify the TEXT object value

CrystalReport1 report = new crystalReport1 ();

CrystalDecisions.crystalreports.Engine.TextObject TB = (Crystaldecisions.crystalReports.Engine.TextObject) Report.ReportDefinition.reportObjects ["text1"];

// or crystaldecisions.crystalreports.Engine.TextObject TB = ReportDefinition.reportObjects ["text1"] as crystaldecisions.crystalreports.Engine.TextObjectReport;

Tb.Text = "Chinese";

// exported to EXCEL: report.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; report.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel; CrystalDecisions.Shared.DiskFileDestinationOptions opt = new CrystalDecisions.Shared.DiskFileDestinationOptions (); Opt.diskFileName = @ "file name"; report.exportOptions.DestinationOptions = Opt; Report.export ();

// Export to Word: report.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; report.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.WordForWindows; CrystalDecisions.Shared.DiskFileDestinationOptions opt = new CrystalDecisions.Shared.DiskFileDestinationOptions (); Opt.diskFileName = @ "file name"; report.exportOptions.DestinationOptions = Opt; Report.export ();

The file name can be built. If there is no existence, it will be created automatically.

转载请注明原文地址:https://www.9cbs.com/read-48869.html

New Post(0)