Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal XI Developer: Automatically export a .txt file

Posted on 2012-03-16
9
Medium Priority
?
315 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 8

Accepted Solution

by:
Crashman earned 1500 total points
ID: 37730180
0
 

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 101

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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 …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

963 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