Solved

Problem when exporting to Excel

Posted on 2004-10-12
6
508 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

810 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