Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i am generating report by using crystal reports.
if i export the report to excel ., the records getting exporting.

But there is no proper alignment.

Now i want to see the records into excel as like crystal report.

Presently i am using the below code for exporting the records into Excel

Try
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New _
DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New ExcelFormatOptions
CrDiskFileDestinationOptions.DiskFileName = _
"c:\crystalExport.xls"
CrExportOptions = cryRpt.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.Excel
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
cryRpt.Export()
Catch ex As Exception
MsgBox(ex.ToString)
End Try

Can you please any one help on this?
Posted

1 solution

try with ExcelUseConstantColumnWidth as false
VB
Dim CrFormatTypeOptions As New ExcelFormatOptions
CrFormatTypeOptions.ExcelUseConstantColumnWidth = False

You may need to change the report as well to avoid alignment issues when exporting to excel. check this article.[^]
 
Share this answer
 
v2
Comments
aarif moh shaikh 17-Nov-14 6:08am    
Write Sir

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900