Link to home
Start Free TrialLog in
Avatar of p_gauri7
p_gauri7

asked on

Crystal Report Export options

Hi,

I am using Vb.NET 2005 and Crystal Reports that come with it. I want to export the report only in word format by clicking crystal report viewer's 'Export Report' button. Is there any way to make the Export file type to .doc only? Currently it defaults to .Rpt. I would like to know if there is a way to make it display .doc by default?

Thanks,
Gauri
Avatar of Nash2334
Nash2334

Not sure about the VB syntax, but to do so you have to specify the export format:

C#
CrystalDecisions.Windows.Forms.CrystalReportViewer viewer  = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
viewer.ReportSource = ...

CrystalDecisions.CrystalReports.Engine.ReportClass reportClass = viewer.ReportSource as CrystalDecisions.CrystalReports.Engine.ReportClass;

reportClass.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, "document.doc");
Avatar of Mike McCracken
Yes there is.  You need to install only the Word export dlls.

If there are other export dlls, it will select the first one as the default.

mlmcc
Avatar of p_gauri7

ASKER

emoreau,

The problem with the solution you have given is that the path to store the report be hard coded. I have to give the user the option where to store the report file.

Gauri
you just need to replace Forms.Application.StartupPath with the path provided by your user
Is ther any event to capture the export button click of the crystal report viewer so that I can get the path selected by the user thru the file dialog and provide it to the  ExportToDisk()?

gauri
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks mlmcc and emorea. I think  it wonlt be possible to add the default file type .doc in the file dialogue of Export  button of the crystal report viewer.

I will split the points between you two.

Gauri
Glad i could help

mlmcc