Print Page | Close Window

Generate multiple files from 1 run

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9231
Printed Date: 27 Apr 2024 at 11:03pm


Topic: Generate multiple files from 1 run
Posted By: jim33
Subject: Generate multiple files from 1 run
Date Posted: 26 Feb 2010 at 5:47am

Is there a way to have a single Crystal report parm run  for multiple selected customers that would produce multiple pages that would actually create multiple individual files for its output? Perhaps in multiple PDF files?

Customers selected

Report runs - 1 page per customer is the output, but based on the customers selected it generates - for example 10 customers/10 pages; how can these 10 pages generate 10 PDF files from this single run?




Replies:
Posted By: lockwelle
Date Posted: 01 Mar 2010 at 6:32am
I don't have much experience with exporting files, but CR is not the brightest, it pretty sees a report as an entity and only exports the entire entity to some file format.  It doesn't understand splitting it up.
 
I think you are out of luck, but someone with more export experience might chime in with a different solution.
 
HTH


Posted By: rdseal
Date Posted: 01 Mar 2010 at 7:48am
I have just (nearly) finished a similar project.

I have created a report that grouped in particular order. when I am using Visual CUT 11 to burst my report into lots of small reports (per group specified earlier in the report). Then saved in special way in specified path for individual file (you can also email it if you need). Very simple and easy to use interface.

Read my original topic: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9201&PID=29165#29165

and don't forget to check out www.kenhamady.com/bookmarks.html. as that is where I found Visual Cut 11.

I know its not a free solution but I am considering to purchase it soon, when my 30 days evaluation is finished :) knowing that it will save me a lot more in the long run (I hope.)

If you find something cheaper or a free ap please let me know.

Hope it will help.



-------------
read read read


Posted By: johnstaj
Date Posted: 15 Dec 2011 at 8:45pm

·         Please refer to the following VB.Net code for exporting to seperate pdf files.

·         Dim rdoc As New ReportDocument

·         '------------------------------------

·         'Add your code to set rdoc object

·         '--------------------------------------

·             Dim exportOpts As ExportOptions = New ExportOptions()
    Dim pdfRtfWordOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
    Dim destinationOpts As DiskFileDestinationOptions = ExportOptions.CreateDiskFileDestinationOptions()
        For li_count As Integer = 1 To pagecount
            pdfRtfWordOpts.FirstPageNumber = li_count
            pdfRtfWordOpts.LastPageNumber = li_count
            pdfRtfWordOpts.UsePageRange = True
            exportOpts.ExportFormatOptions = pdfRtfWordOpts
            exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat

            destinationOpts.DiskFileName = "D:\report File" & li_count & ".pdf"
            exportOpts.ExportDestinationOptions = destinationOpts
            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
            rdoc.Export(exportOpts)

        Next

Please let me know the result.



Posted By: VandalHeart
Date Posted: 15 Mar 2012 at 6:08am
@ member_profile.asp?PF=14323&FID=7 - johnstaj :
Thanks for your code, it works grat. My problem is a little different, i need to export in pdf making a file for each group but i don't know how many page is the report in each group, can you help me please?


Posted By: johnstaj
Date Posted: 18 Mar 2012 at 11:06pm
Hi,

You need to create separate pdf files for each group.

Suppose Dt_Group (datatable) contains all the required groups and its unique ids
        Dim exportOpts As ExportOptions = New ExportOptions()
        Dim pdfRtfWordOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
        Dim destinationOpts As DiskFileDestinationOptions = ExportOptions.CreateDiskFileDestinationOptions()
pdfRtfWordOpts.UsePageRange  = False
            exportOpts.ExportFormatOptions = pdfRtfWordOpts
            exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat


for Li_count as integer=0 to Dt_Group.rows.count-1
           rdoc.setDatasource(Dataset) 'create new dataset for each Group
            destinationOpts.DiskFileName = "D:\report File" & "group name" & ".pdf"
            exportOpts.ExportDestinationOptions = destinationOpts
            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
            rdoc.Export(exportOpts)


next




Posted By: VandalHeart
Date Posted: 19 Mar 2012 at 4:27am
Thanks a lot for your attention, your post is very useful, i've decided to get the group nome via vb.net, so i launch the report and export it for every groups because there are other conditions to care about when grouping.


Posted By: howardW
Date Posted: 20 Mar 2012 at 12:35pm
Jim -
 
I use VisualCut from Millet Software for exactly this purpose.... It can burst a report into multiple individual reports based on fields in your report.
 
So if you had 20 customers you could create 20 reports and put them into folders for each customer like this
 
C:\
     {Cust_name}.{Cust_number}\invoice_{due_date}.pdf
 
You'd end up with
 
c:\JoesHardware.12345\invoice_12-2-2011.pdf
c:\Toms Taxi.98765\invoice_11-12-2011.pdf
 
And so on
 
Note; i do not own or have any financial interest in the software, just a happy user!



Print Page | Close Window