Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal XI Developer: Automatically export a .txt file

Posted on 2012-03-16
9
Medium Priority
?
312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

705 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