Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

After exporting to Excel the Alignment / Formating is messed up!

Posted on 2004-04-08
4
Medium Priority
?
1,103 Views
Last Modified: 2012-05-04
Hi There,

I am using Crystal Reports 9 and VB 6 for exporting it to Excel. The export works fine but the final exported xls sheet is not what I expect. all the columns have equal width and the allignment is all messed up. I even used ruler lines in the designer to help allign the columns vertically but still no use. But when I export it directly through crystal reports, its perfect. with columns widths and allignment are all according to what i have given in the report.

I am using the following code to export please suggest.

                Dim Appl As New CRAXDRT.Application
                Dim Rpt  As CRAXDRT.Report

                Rpt.ExportOptions.FormatType = crEFTExcel97
                Rpt.ExportOptions.ExcelUseConstantColumnWidth = False  
                Rpt.ExportOptions.DestinationType = crEDTDiskFile
                Rpt.Export False

for the statement "Rpt.ExportOptions.ExcelUseConstantColumnWidth = False" even if I give True here it still gives the same output. I even tried Different FormatTypes like Excel80 etc. But no use.

Thanks,
Faisal.
0
Comment
Question by:faisalee
  • 2
  • 2
4 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 750 total points
ID: 10783042
This is an undocumented "feature" of Crystal.  Crystal attempts to recreate the report in its exact format in Excel.  Unfortunately Excel is probably using different fonts so things end up not aligning as expected.  Also they don't fit into single columns so manipulation is difficult.

Look at
http://www.experts-exchange.com/Databases/Crystal_Reports/Q_20946957.html#10780149

I believe CR9 has the ability to export the data only which might do what you want.  

Because of this problem (I use CR8) and the fact that all my users want a "true" spreadsheet when they export a report I wrote code to do the export using the recordset rather than allow Crystal to do the export.

mlmcc

0
 

Author Comment

by:faisalee
ID: 10803017
Hi mlmcc,

Thanks for the answer... I also thought the same As you said that, "its an undocumented issue in Crystal reports", but still the url to the PDF contains some great info about exporting to Excel :-) Thanks anyways.

Looks like I will have to write code to export directly to excel instead of using crystal reports. The only problem is that we have already finished the 500 + reports to do the this job :-(

Oh well... Maybe we can extend the project a little bit or we can convince the clients to live with the generated XLS files as they are ;-)

Thanks any ways for the prompt reply.

Faisal.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10803043
I have code already written that uses the query the report is based on to do the export.  I can make it available if you wish.

mlmcc
0
 

Author Comment

by:faisalee
ID: 10803071
Oh great... that will solve half of the problem :-) you can send it to me at <email address removed by mlmcc PE>

Thanks for the great help.

Faisal.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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…
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 …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

926 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