473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Exporting crystal report to excel problem

77
Hi all,
I have a report in crystal report when I export it to excel each column will be shown in 2 or 3 merged columns!!!
The worst part is that sometimes the header of the column is in the A and B columns but the details of this columns are in B and C in excel sheet!!!
I don’t want that and I want to have normal excel sheet with the boarders around each cell what should I do?
Here is the example of my exported report in excel:
Expand|Select|Wrap|Line Numbers
  1. A        B        C        D        E        F          G    
  2. Case         Customer Name                                 Tel
  3. 1                        John                1232547
  4. 2                        Jane                9999999    
  5. 3                        Mark                99999544
  6. 4                        Harry                8789874
  7.  
  8. What I need in excel is:
  9. A    B        C        
  10. Case     Customer Name     Tel
  11. 1    John        1232547
  12. 2    Jane        9999999    
  13. 3    Mark        99999544
  14. 4    Harry        8789874
  15.  
Please help me.
Sep 17 '08 #1
4 5927
I used to come across this problem before.
What i have done is to rearrange all fields in crystall report and make sure header and value field is in the same column(same position, width and height).
you can use snap to grid in Crystal Report to help you in arranging fields.

Finally, you will get a good result in excel file.
Dane
Sep 18 '08 #2
I exploitation report use VS2005 RDLC,it Export to excel is very good .
Sep 18 '08 #3
There is no need to involve Crystal Reports if all you want is to export your data into an excel spreadsheet. Below is the code that worked for me:

Private Sub ExportToExcel(ByVal GridView1 As GridView)

Try
Dim strFileName As String = "Report" & ".xls"
Dim strFilePath As String = "C:\temp\" & strFileName
If File.Exists(strFilePath) Then
File.Delete(strFilePath)
End If

Dim oStringWriter As New StringWriter
Dim oHtmlTextWriter As New HtmlTextWriter(oStringWriter)
Dim objStreamWriter As StreamWriter
Dim strStyle As String = Environment.NewLine

objStreamWriter = File.AppendText(strFilePath)
GridView1.RenderControl(oHtmlTextWriter)
objStreamWriter.WriteLine(strStyle)
objStreamWriter.WriteLine(oStringWriter.ToString)
objStreamWriter.Close()
Me.btnExportToExcel.Attributes.Add("OnClick", "wOpen()")

Catch ex As Exception

End Try
End Sub
Sep 18 '08 #4
Sep410
77
I used to come across this problem before.
What i have done is to rearrange all fields in crystall report and make sure header and value field is in the same column(same position, width and height).
you can use snap to grid in Crystal Report to help you in arranging fields.

Finally, you will get a good result in excel file.
Dane

Thanks,
That was what I needed.
It is working well now.
Sep 18 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ali Eghtebas | last post by:
Hi, I tried this demo application in here (watch for any line breaks in the URL): (http://support.crystaldecisions.com/communityCS/FilesAndUpdates/vbnet_win_a dodotnet.exe.asp When exporting...
0
by: George G. | last post by:
I am exporting a report to an Excel file. Whatever options I use for the formatting the results remain the same. I have set the ExcelTabHasColumnHeadings to true and false without any difference. I...
4
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear"...
1
by: Lasso | last post by:
Hi all, Im having problem in exporting pdf file from crystal report. Now I already can show the crystal report but error when exporting. this is my code: Dim myReport As USERReport = New...
2
by: Mustufa Baig | last post by:
Hi everybody, I have an ASP.NET website where clients can view their monthly billings by selecting different options. One of the option is the way they want to see the report i.e. whether they...
1
by: Mustufa Baig | last post by:
I have an ASP.NET website where I am showing off crystal reports to users by exporting them to pdf format. Following is the code: ---------------- 1 Private Sub ExportReport() 2 Dim oStream...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
0
by: pradeep kumar pc | last post by:
Hi everybody I have a problem when exporting to MS Excel(Office XP) in Crystal Report 8.5 No data is in Excel file. But no problem in MS Office xp and windows xp Pls Let me know how to solve...
3
by: jennwilson | last post by:
Access 2000 - I have developed a database that houses patient information. The patient information must be sent in an excel file to another company department. I know how to export my data to Excel...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.