Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Export crystal report to text format Post Reply Post New Topic
Author Message
jazzright
Newbie
Newbie


Joined: 01 Apr 2008
Location: Fiji
Online Status: Offline
Posts: 15
Quote jazzright Replybullet Topic: Export crystal report to text format
    Posted: 26 Jun 2008 at 5:46pm
Hi All,

I want to export the crystal report to text format. I am using Visual Studio 2005 and crystal report which is with it.

Please help me how to go about doing it.
IP IP Logged
RHar
Newbie
Newbie


Joined: 25 Jun 2008
Online Status: Offline
Posts: 5
Quote RHar Replybullet Posted: 27 Jun 2008 at 1:11am
I use this code to export to pdf. I also use a Save file Dialog to get the path and file name to export too.

Dim rpt As New cRptInspections() "My CrystalReportDocument"
rpt = cRptViewer.ReportSource "My CrystalReportViewer"
rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, SaveFileDialog1.FileName)

try for text

rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Text, SaveFileDialog1.FileName)

Edited by RHar - 27 Jun 2008 at 1:17am
IP IP Logged
jazzright
Newbie
Newbie


Joined: 01 Apr 2008
Location: Fiji
Online Status: Offline
Posts: 15
Quote jazzright Replybullet Posted: 27 Jun 2008 at 1:16am
Hi,

CrystalDecisions.Shared.ExportFormatType.Text option is not available. Any idea how can i make that option available.

any suggestion on the font coz iam printing to a line printer...font are not very clear.
IP IP Logged
RHar
Newbie
Newbie


Joined: 25 Jun 2008
Online Status: Offline
Posts: 5
Quote RHar Replybullet Posted: 27 Jun 2008 at 1:20am
Not sure why it don't show.

try
CrystalDecisions.Shared.ExportFormatType.RichText
CrystalDecisions.Shared.ExportFormatType.WordForWindows
IP IP Logged
Puneri
Newbie
Newbie


Joined: 19 Jun 2008
Location: Kuwait
Online Status: Offline
Posts: 10
Quote Puneri Replybullet Posted: 01 Jul 2008 at 4:53am
what is cRptInspections() in the first line of sample code?
I do not find any such class... please clarify
Also can we set export destination folder path?
My requiremnt is, when report is generated it should be saved on server in app_data
How to do this?

Edited by Puneri - 01 Jul 2008 at 4:57am
IP IP Logged
RHar
Newbie
Newbie


Joined: 25 Jun 2008
Online Status: Offline
Posts: 5
Quote RHar Replybullet Posted: 01 Jul 2008 at 4:58am
cRptInspection is my Crystal Report Document component.
IP IP Logged
RHar
Newbie
Newbie


Joined: 25 Jun 2008
Online Status: Offline
Posts: 5
Quote RHar Replybullet Posted: 01 Jul 2008 at 5:03am
You can specify the path and file name.

ex. rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "\\app_server\Docs\test.pdf")
IP IP Logged
Puneri
Newbie
Newbie


Joined: 19 Jun 2008
Location: Kuwait
Online Status: Offline
Posts: 10
Quote Puneri Replybullet Posted: 01 Jul 2008 at 11:51pm
I'm not getting how u've defined "report document" component. Following is the code, but I'm getting error in it. Can u help me to correct this code?
I have created one aspx page in which I'm displaying contents of crystal report. Also I've to save this report for future reference.
               
Me.CrEmReport.ParameterFieldInfo.Clear()
Me.CrEmReport.ReportSource =Server.MapPath("EmCallupReport.rpt")
Dim ParamFields As ParameterFields = Me.CrEmReport.ParameterFieldInfo
Dim emTicketId As New ParameterField
emTicketId.Name = "VTICKETID"
Dim emTicketId_Value As New ParameterDiscreteValue
emTicketId_Value.Value = objTicket.ticketId
emTicketId.CurrentValues.Add(emTicketId_Value)
ParamFields.Add(emTicketId)
For Each cnInfo As TableLogOnInfo In Me.CrEmReport.LogOnInfo
cnInfo.ConnectionInfo = ConnInfo

Next
    Dim strDate As String = Convert.ToString(objTicket.emRaisedDate)
    Dim objReportDoc As New ReportDocument
    objReportDoc = CrEmReport.ReportSource
    objReportDoc.ExportToDisk(ExportFormatType.PortableDocFormat, "\\app_data\\uploads\\Reports\\Emergency\\Emergency_" & objTicket.deptName & "_" & strDate)

IP IP Logged
Puneri
Newbie
Newbie


Joined: 19 Jun 2008
Location: Kuwait
Online Status: Offline
Posts: 10
Quote Puneri Replybullet Posted: 03 Jul 2008 at 4:42am
I'm getting error at red line as,
Unable to cast object of type 'CrystalDecisions.ReportSource.NonHTTPCachedReportSource' to type 'CrystalDecisions.CrystalReports.Engine.ReportDocument'
Can u please give sample code to create report document component?
IP IP Logged
jhodz2001
Newbie
Newbie
Avatar

Joined: 20 Jul 2008
Location: Philippines
Online Status: Offline
Posts: 9
Quote jhodz2001 Replybullet Posted: 22 Jul 2008 at 12:18am
hello,
 
<Dim strDate As String = Convert.ToString(objTicket.emRaisedDate)
<Dim objReportDoc As New ReportDocument

<objReportDoc = CrEmReport.ReportSource
<objReportDoc.ExportToDisk(ExportFormatType.PortableDocFormat,
 
change these lines to these...
 
Dim strDate As String = Convert.ToString(objTicket.emRaisedDate)
Dim objReportDoc As New ReportDocument
objReportDoc = CrEmReport
objReportDoc.ExportToDisk(ExportFormatType.PortableDocFormat,
 
 
hope it would work for you....
 
 


Edited by jhodz2001 - 22 Jul 2008 at 12:19am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.063 seconds.