Solved

Problem when exporting to Excel

Posted on 2004-10-12
6
506 Views
Last Modified: 2008-02-01
I have written a simple .rpt viewer using the Crystal Report Viewer control in VB.net 2003. When reports are exported using the export button on the control, several alignment and spacing errors are present. However, these formatting errors are not present if I view and export a report using the Crystal Reports software that I use to design the reports. I'm pretty sure that the problem lies with my report viewer program not using the proper .dll. How do I tell my program to use a different dll to export files? Thanks.
0
Comment
Question by:smoothrockb
  • 2
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 12288140
The problem is not with the dll.  To get a report to export as you want you need to set it up correctly.  Crystal tries to export the report as it is to Excell but Excel coulmns cause trouble.

Look at

http://support.businessobjects.com/communityCS/TechnicalPapers/scr_exportexcel.pdf.asp

mlmcc
0
 

Author Comment

by:smoothrockb
ID: 12289190
I have seen that article, and I don't think it is any help for me, since my reports export to Excel without problems using Crystal Reports 8.5. When I export a program via the Report Viewer control in my viewer application, there are formatting errors, merged cells, misaligned column headers, etc. Also, the gridlines do not appear in the exported excel file. I would rather not have to redesign a large number of reports if I can avoid it. Is there a way to expand the export options packed in with the CrystalReportViewer control in VB.net to be more consistent with the export options present in Crystal Reports?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 12290651
I don't think so since CR.Net is a stripped down version of CR9.

Also Crystal deliberately limited the export options on some of the viewers to encourage use of the RDC.

mlmcc
0
 

Author Comment

by:smoothrockb
ID: 12426321
I figured out a way to come pretty close to the "data only" export option a la the full Crystal Reports software, using the "Export()" method and adjusting settings that way. In case anyone is interested, my code looked like:

If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
            Dim OpenFile As String
            OpenFile = SaveFileDialog1.FileName

            Report1.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
            Dim fileOptions As New CrystalDecisions.Shared.DiskFileDestinationOptions
            fileOptions.DiskFileName = OpenFile
            Report1.ExportOptions.DestinationOptions = fileOptions
            Report1.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.Excel
            Dim excelOptions As New CrystalDecisions.Shared.ExcelFormatOptions
            excelOptions.ExcelUseConstantColumnWidth = False
            excelOptions.ExcelTabHasColumnHeadings = False
            Report1.ExportOptions.FormatOptions = excelOptions

            Report1.Export()
        End If



0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12464658
Question answered by asker or dialog valuable.
Closed, 125 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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. …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

9 Experts available now in Live!

Get 1:1 Help Now