Solved

Crystal XI Developer: Automatically export a .txt file

Posted on 2012-03-16
9
304 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:QTony
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

12 Experts available now in Live!

Get 1:1 Help Now