Solved

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

Posted on 2004-04-08
4
1,041 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 100

Accepted Solution

by:
mlmcc earned 250 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 100

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

18 Experts available now in Live!

Get 1:1 Help Now