Solved

Crystal XI Developer: Automatically export a .txt file

Posted on 2012-03-16
9
309 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
LVL 8

Accepted Solution

by:
Crashman earned 500 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 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