Solved

Crystal XI Developer: Automatically export a .txt file

Posted on 2012-03-16
9
306 Views
Last Modified: 2012-03-16
I use Crystal to create a .txt file that I export for use in AutoCad. As of now, the user has to manually export the text file after the report has completed.

Is it possible to set up the report so that it automatically exports itself after the report has run?

The export is always to the same folder so it would also have to automatically overwrite itself.

Thank you for looking.
0
Comment
Question by:QTony
  • 4
  • 3
9 Comments
 
LVL 8

Expert Comment

by:Crashman
ID: 37730056
Private Sub ExportToDisk(ByVal myReportDocument As ReportDocument, ByVal fileName As String)
Dim myExportOpts As New ExportOptions
Dim diskOpts As DiskFileDestinationOptions
diskOpts = ExportOptions.CreateDiskFileDestinationO…

myExportOpts.ExportFormatType = _
ExportFormatType.RichText
myExportOpts.ExportDestinationType = _
ExportDestinationType.DiskFile

diskOpts.DiskFileName = fileName
myExportOpts.ExportDestinationOptions = diskOpts

myReportDocument.Export(myExportOpts)
End Sub

Open in new window

0
 

Author Comment

by:QTony
ID: 37730141
Thanks for responding.

Please forgive my ignorance. My exposure to Crystal is that every couple of years I need to get into it and then I can't remember all the things I learned the last time I worked with it:

Does this routine run as a formula that I need to place correctly somewhere in the report?

I'm assuming that I need to enter my output file name in those locations where you have "filename" entered but I got an error.


I tried entering the file name enclosed in quotes and also not enclosed in quotes.

Private Sub ExportToDisk(ByVal myReportDocument As ReportDocument, ByVal "C:\CTRtoCAD\CTRtoCAD.txt" As String)
Dim myExportOpts As New ExportOptions
Dim diskOpts As DiskFileDestinationOptions
diskOpts = ExportOptions.CreateDiskFileDestinationO…

myExportOpts.ExportFormatType = _
ExportFormatType.RichText
myExportOpts.ExportDestinationType = _
ExportDestinationType.DiskFile

diskOpts.DiskFileName = "C:\CTRtoCAD\CTRtoCAD.txt"
myExportOpts.ExportDestinationOptions = diskOpts

myReportDocument.Export(myExportOpts)
End Sub
0
 
LVL 8

Expert Comment

by:Crashman
ID: 37730157
this is Visual Basic .net Code, is not a formula, load the report and is this aplication who does the export
0
 
LVL 8

Accepted Solution

by:
Crashman earned 500 total points
ID: 37730180
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:QTony
ID: 37730215
Thanks for that. So I just save it on the desktop as a VB routine?  Again, forgive my ignorance,

I know nothing about VB.net:

What file extension do I use when I save the routine and do I need to enclose the strings in some kind of single or double quotation marks?

Do I need to enter the full path to my report?

Thanks
0
 

Author Comment

by:QTony
ID: 37730227
I thought there might be some kind of internal file export option in Crystal. I see that this is going to require more research.

Thanks for your help.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37730627
Crystal has no way of doing what you want automatically.  You have to create an application that will take the report and export it directly to text.  This method will not provide a preview of the report before exporting.

If you need to preview the report then the method you currently use is probably as efficient as any.

mlmcc
0
 

Author Comment

by:QTony
ID: 37730977
Thank you.  No, no preview is necessary. The only function of the report is to generate line by line info for export.

Example:

1
1
25.50
130.00
Lobby 101
A Std PL-2 color
True
False
False
Default

I will take your advice and look for some kind of export utility.

Moderator: I made an error when I closed this topic. I thought I had accepted Crashman's response and had added this final entry:

This problem requires more research. It is unfair to the responder to ask she / he for additional info


I didn't mean to accept my own response. Please let me know if I need to do anything to correct this.

Thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Store total calculated duration sessions. 44 75
Crystal Report for VS2013 17 77
Conditional Page Breaks Based On Grouping 1 23
Crystal report highlighting 5 29
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now