1

I'm trying to break a multi page crystal report into multiple files by page and name according from their respective fields. I've been fooling around with the code from this question however I run into all type of SAP error's. Is there not a simple way to iterate say like:

foreach(var page in CrystalReport)
{
    report.ExportTiDisk(ExportFormatType.WordForWindows, page.[NameField]);
}

Worst case I could do this with the Word API but that another can of worms I'd rather not open.

Thank you in advance

Community
  • 1
  • 1
bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83

2 Answers2

2

Dear please check the code.

Why you need to export in multiple files, it is bad as suppose you have a report with 300 pages result, then are you think to make 300 files to export and customer to check each & every files. Think again.

Still here is solution, 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

refer link export in multiple file

You have not written your CR-version, So please refer to this link also which says, not able to export in multiple files in cr-2008.

http://social.msdn.microsoft.com/Forums/en-US/f85e167d-edb3-44d0-82fc-2d2b6f92f57b/how-do-i-export-multiple-pdf-files-from-a-single-crystal-report-ie-a-pdf-file-for-each?forum=vscrystalreports

http://scn.sap.com/thread/1132776

Community
  • 1
  • 1
Ajay2707
  • 5,690
  • 6
  • 40
  • 58
  • They are only 5-10 pages and each page much be emailed to a separate client hence the need to split. Thankyou – bumble_bee_tuna Jun 17 '14 at 15:48
  • Don't question "why" - if they need to they need to. In our case there is a report that generates productivity reports for about 25 employees, and we want each individual to be able to access their report, without seeing anyone else's information – PoloHoleSet Dec 01 '20 at 17:43
1

The process of splitting a report in multiple files is known as bursting. You can split by group , not by page. However splitting by group will allow you to split based on the data , not by mechanical reason like page number. As a result if you have a customer with more data which is printed on 2 pages the report will be spitted correctly and the generated file for this customer will be 2 pages too. Bursting is a little bit complicate to develop but there are few tools on the market that can do it. Check this video : http://www.r-tag.com/Pages/Preview_Bursting.aspx I believe the tool in this video is free.

Lan
  • 1,335
  • 1
  • 9
  • 14
  • the code posted above works flawlessly. There is allot of disingenuous information posted regarding crystal reports by ISV trying to peddle their products. – bumble_bee_tuna Jun 17 '14 at 18:24
  • I am happy for you. Did you check the code above for cases when client information is on more than one page ? As it is mentioned , the link in my post is to a free product. So I am not getting your point. – Lan Jun 18 '14 at 00:08