Solved

Problem when exporting to Excel

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

789 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