on 09-26-2008 5:29 AM
I have a problem to export Excel format. I am using Crystal Report 2008, VB.net2008(CS) and Oracle 10g.
I was already following bellow articles.
I have tested by myself...
one thing, I included "Call DataReport"
It is not working to export Excel and rtf format.
last thing, I did not include "Call DataReport"
It is working to export Excel and rtf format..
Why it is someting wrong?
I have installed sp0 and tested CRdesiner..
Private Sub butprint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butprint.Click
'Create Data
Call DataReport()
'Login Report
Call ConfigureCrystalReports()
With CrystalReportViewer1
.DisplayBackgroundEdge = True
.DisplayStatusBar = True
.DisplayToolbar = True
.Zoom(90)
End With
End Sub
Private Sub ConfigureCrystalReports()
'모래시계로 변경
Me.Cursor = Cursors.WaitCursor
'프로젝트에 포함된 보고서 사용 선언
'Dim crReport As New RPTNEWPROJECTPLANBYDSE()
'사용할 수식 필드 지정
Dim crFormulas As FormulaFieldDefinitions
Dim crFormulaTextField1, crFormulaTextField2, crFormulaTextField3, crFormulaTextField4, crFormulaTextField5, crFormulaTextField6 As FormulaFieldDefinition
'수식 필드 목록을 지정
crFormulas = crReport.DataDefinition.FormulaFields
'수식필드 지정
crFormulaTextField1 = crFormulas.Item(1)
crFormulaTextField2 = crFormulas.Item(2)
crFormulaTextField3 = crFormulas.Item(3)
crFormulaTextField4 = crFormulas.Item(4)
crFormulaTextField5 = crFormulas.Item(5)
crFormulaTextField6 = crFormulas.Item(6)
'Formula에 관한 날짜 구해옴
Dim Exp_Start_Year, Exp_End_Year, New_Start_Year, New_End_Year As String
Exp_Start_Year = Mid(Me.dtpStartYear.Text - 2, 3, 2)
Exp_End_Year = Mid(Me.dtpStartYear.Text - 1, 3, 2)
New_Start_Year = Mid(Me.dtpStartYear.Text - 1, 3, 2)
New_End_Year = Mid(Me.dtpStartYear.Text, 3, 2)
'변수의 필드 이름을 전달
If Me.ComCur.Text = "" Then
crFormulaTextField1.Text = Chr(34) & "Currency : All" & Chr(34) 'CUR
Else
crFormulaTextField1.Text = Chr(34) & "Currency : " & Me.ComCur.Text & Chr(34) 'CUR
End If
crFormulaTextField2.Text = Chr(34) & "FY" & Mid(Me.dtpCurrentDate.Text, 3, 2) & " New Project Plan by DSE" & Chr(34) 'TITLE
crFormulaTextField3.Text = Chr(34) & "Exp(SOP: Oct " & Exp_Start_Year & "~ Sep " & Exp_End_Year & ")" & Chr(34) 'EXP
crFormulaTextField4.Text = Chr(34) & "New(SOP: Oct " & New_Start_Year & "~ Sep " & New_End_Year & ")" & Chr(34) 'NEW
crFormulaTextField5.Text = Chr(34) & Me.dtpPreviousDate.Text & Chr(34) 'PRE_DATE
crFormulaTextField6.Text = Chr(34) & Me.dtpCurrentDate.Text & Chr(34) 'CUR_DATE
' CrystalReportViewer1.ReportSource = crReport
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
With myConnectionInfo
.ServerName = "XXXXX"
.DatabaseName = "XXXXX"
.UserID = "XXXXX"
.Password = "XXXXX"
End With
Dim myTableLogOnInfo As TableLogOnInfo
Dim myTableLogOnInfos As TableLogOnInfos
myTableLogOnInfo = New TableLogOnInfo
myTableLogOnInfos = New TableLogOnInfos
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
myTableLogOnInfos.Add(myTableLogOnInfo)
'뷰어에 테이블 정보를 지정
CrystalReportViewer1.LogOnInfo = myTableLogOnInfos
CrystalReportViewer1.ReportSource = crReport
'화살표로 변경
Me.Cursor = Cursors.Arrow
End Sub
Private Sub DataReport()
Dim strparameter(3) As String
Dim strvalue(3) As String
Dim objOracleType(3) As OracleType
Dim intLength(3) As Integer
Dim intLoop As Integer
strvalue(0) = Mid(Me.dtpStartYear.Text, 1, 4)
strvalue(1) = Me.dtpPreviousDate.Text
strvalue(2) = Me.dtpCurrentDate.Text
strvalue(3) = Me.ComCur.Text
strparameter(0) = "P_START_YEAR"
strparameter(1) = "P_PREDATE"
strparameter(2) = "P_CURDATE"
strparameter(3) = "P_CUR"
For intLoop = 0 To strvalue.Length - 1
objOracleType(intLoop) = OracleType.Char
Next
intLength(0) = 4
intLength(1) = 7
intLength(2) = 7
intLength(3) = 3
Try
'DB Open
OrcaleConn.DBOpen()
OrcaleConn.ExecuteSqlWithParam("RPT_NEWPJOJECTPLANBYDSE ", strparameter, objOracleType, intLength, strvalue, True)
OrcaleConn.DBClose()
'CrystalReportViewer1.ReportSource = crReport
Catch ex As Exception
OrcaleConn.UnhandledExecptionHandler()
End Try
End Sub
A few questions;
1) Confirm that adding "C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86
" to the front of the path variable did not help
2) Can you export to xls and rtf from the CR designer?
3) Can you export a "saved data" report to either xls or rtf in your app?
4) From the code, it looks like you are exporting using the export button of the CR viewer?
5) What Operating System are you working on? And is this your development computer?
6) Is this a web or a win app?
Ludek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1) Confirm that adding "C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86
" to the front of the path variable did not help
A : I already had that folder.
2) Can you export to xls and rtf from the CR designer?
A : Yes, I can export all format from the CR designer.
3) Can you export a "saved data" report to either xls or rtf in your app?
A : No, I can not export xls and rtf in my app.
4) From the code, it looks like you are exporting using the export button of the CR viewer?
A : That's right. I was using export button of the CR viewer.
But I have tried to using export code. It was same as export button of the CR Viewer.
5) What Operating System are you working on? And is this your development computer?
A : My OS is Win XP and Service pack 3.
And that is my development PC.
6) Is this a web or a win app?
A: just win app.
^^
Thank you for your answer.
I would like to find why it is something wrong as soon as possible.
Edited by: Hyoung Youn Lee on Sep 29, 2008 1:33 AM
There are two things I want to confirm:
1) Confirm that adding "C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86
" to the front of the path variable did not help
A : I already had that folder.
- I understand that folder exist, but is the path in the environment var? E.G; here are the steps I want you to try:
a) Go to the "system properties"
b) Click on the <Environment Variables> button
c) Edit the "Path" variable by putting the full path to the CR 2008 bin directory (...\win32_x86) at the front of the Path string
3) Can you export a "saved data" report to either xls or rtf in your app?
A : No, I can not export xls and rtf in my app.
- Understood. But, if you run the report in the CR designer, go to the File menu and select "Save Data with Report", then save the report. Now comment out any logon code in your app and try to run the saved data report. Does it run? Note: This is just a test to see how the behavior on your computer compares to others.
I need to be clear about all of the above as this is a new issue that we can not reproduce in house. Thus I need as much info as possible so I can compare your issue to those reported by others on this forum.
One other test. Let me know if you can export to .DOC file format...
Ludek
Thanks Ludek
I was following your answer.
I added path like bellow. It was success.
But I am wondering about the path. When I make install version, how can i put path automatically? or Do I have to put path each client pc?
-
- I understand that folder exist, but is the path in the environment var? E.G; here are the steps I want you to try:
a) Go to the "system properties"
b) Click on the button
c) Edit the "Path" variable by putting the full path to the CR 2008 bin directory (...\win32_x86) at the front of the Path string
Unfortunately, that is the really difficult thing about this work-around. As you can see from this sticky post:
we are trying to collect as much data on the issue as possible so we can get it resolved. However, to date, we have not been able to duplicate the issue in house. I have never worked with setting variables in a runtime package, but perhaps these will help:
http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_kmmj.mspx?mfr=true
http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar05/hey0318.mspx
Ludek
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.