Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text export option in Web pages

Status
Not open for further replies.

MPolin

Programmer
Sep 10, 2003
7
US
Has anyone been able to export to text in a web page using CrystalReportViewer? The export options do not include text, are there no other options?
 
You can export to text in CR 9 if you use Report Application Server (RAS).
 
BELOW IS A CUT OUT OF MY APPLICATION WHERE I USE REPORTENGINE TO LOAD REPORTS BUT AM TRYING TO USE CRAXDRT TO EXPORT REPORTS TO TEXT FORMAT. IF AT ALL POSSIBLE YOU COULD GIVE ME SOME FEEDBACK, I'D REALLY,REALLY APPRECIATE IT. MY TWO PROBLEMS ARE (1)GETTING MY REPORT FILE TO THE CRAXDRT.REPORT AND (2)I CAN SEE IN DEBUG THE REPORT AND ALL THE VALUES, BUT WHEN I EXPORT NOTHING HAPPENS IT JUST HANGS.

//To export to formats such as Text and Comma-separated values (CSV),
//use the RDC COM component (Craxdrt) through interop assemblies.


using System.Runtime.InteropServices;

namespace catcrystalreports
{
public class CrRptVw : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button ExportButton;
protected System.Web.UI.WebControls.DropDownList ExportFormatDropDownList1;
protected CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument1;
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
CRAXDRT.Application crxApp;
CRAXDRT.Report crxRpt;
CRAXDRT.ExportOptions crxExpOpts;

private void Page_Load(object sender, System.EventArgs e)
{
}

protected void ExportButton_OnClick(object sender, System.EventArgs e)
{

//Get reports export options
crxExpOpts = crxRpt.ExportOptions;

//Set the export options
crxExpOpts.FormatType = CRAXDRT.CRExportFormatType.crEFTCommaSeparatedValues;
crxExpOpts.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile;
crxExpOpts.DiskFileName = "c:\\1test\\CATLAT.csv";

//Export the report without prompting
crxRpt.Export(false);

#region Web Form Designer generated code
//
override protected void OnInit(EventArgs e)
{
// CODEGEN: This call is required by the ASP.NET Web Form Designer.

InitializeComponent();
base.OnInit(e);

#region Load viewer (I have a treeview where I display the reports on the server and then load them to the report viewer here)

#region LOAD VIEWER AND LOG ONTO REPORT(I have a treeview where I display the reports on the server and then load them to the report viewer here)

report = new ReportDocument();
report.Load(Request.QueryString[CRConstants.COMMON_REPORTPATH].ToString());
CRAXDRT.Application crxApp = new CRAXDRT.Application();
CRAXDRT.Report crxRpt;
//return an instance of the report
crxRpt = crxApp.OpenReport(Request.QueryString[CRConstants.COMMON_REPORTPATH].ToString(),1);

crConnectionInfo = new ConnectionInfo();
ect, ect, ect.

private void InitializeComponent()
{
this.Export.Click += new System.EventHandler
this.Export_Click);
 
BELOW IS A CUT OUT OF MY APPLICATION WHERE I USE REPORTENGINE TO LOAD REPORTS BUT AM TRYING TO USE CRAXDRT TO EXPORT REPORTS TO TEXT FORMAT. IF AT ALL POSSIBLE YOU COULD GIVE ME SOME FEEDBACK, I'D REALLY,REALLY APPRECIATE IT. MY TWO PROBLEMS ARE (1)GETTING MY REPORT FILE TO THE CRAXDRT.REPORT AND (2)I CAN SEE IN DEBUG THE REPORT AND ALL THE VALUES, BUT WHEN I EXPORT NOTHING HAPPENS IT JUST HANGS.
THANKS IN ADVANCE, MARYELLEN

//To export to formats such as Text and Comma-separated values (CSV),
//use the RDC COM component (Craxdrt) through interop assemblies.


using System.Runtime.InteropServices;

namespace catcrystalreports
{
public class CrRptVw : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button ExportButton;
protected System.Web.UI.WebControls.DropDownList ExportFormatDropDownList1;
protected CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument1;
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
CRAXDRT.Application crxApp;
CRAXDRT.Report crxRpt;
CRAXDRT.ExportOptions crxExpOpts;

private void Page_Load(object sender, System.EventArgs e)
{
}

protected void ExportButton_OnClick(object sender, System.EventArgs e)
{

//Get reports export options
crxExpOpts = crxRpt.ExportOptions;

//Set the export options
crxExpOpts.FormatType = CRAXDRT.CRExportFormatType.crEFTCommaSeparatedValues;
crxExpOpts.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile;
crxExpOpts.DiskFileName = "c:\\1test\\CATLAT.csv";

//Export the report without prompting
crxRpt.Export(false);

#region Web Form Designer generated code
//
override protected void OnInit(EventArgs e)
{
// CODEGEN: This call is required by the ASP.NET Web Form Designer.

InitializeComponent();
base.OnInit(e);

#region Load viewer (I have a treeview where I display the reports on the server and then load them to the report viewer here)

#region LOAD VIEWER AND LOG ONTO REPORT(I have a treeview where I display the reports on the server and then load them to the report viewer here)

report = new ReportDocument();
report.Load(Request.QueryString[CRConstants.COMMON_REPORTPATH].ToString());
CRAXDRT.Application crxApp = new CRAXDRT.Application();
CRAXDRT.Report crxRpt;
//return an instance of the report
crxRpt = crxApp.OpenReport(Request.QueryString[CRConstants.COMMON_REPORTPATH].ToString(),1);

crConnectionInfo = new ConnectionInfo();
ect, ect, ect.

private void InitializeComponent()
{
this.Export.Click += new System.EventHandler
this.Export_Click);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top