Crystal Reports Recordselection formula not working while exportin

G

Guest

Hi,

Record selection Formaula is not working while exporting the report to Excel
There is absolutely no problem while using a crystal report viewer but if i
export it to a excel the selection formula dosen't seems to have any effect .
For the Report I am using a Stored procedure . Selection Formula is working
Fine
wile I am using a Crystal report viewer .


rpt1.SetParameterValue(0, line.Value)
rpt1.SetParameterValue(1, agents.Value)

Dim name, cntype As String
name = "IR-" & agents.Value & "-" & strblno & ".xls"
cntype = "Application/x-msexcel"
Dim str As Stream

Dim rExpOpts As New ExportOptions
rExpOpts.ExportFormatType = ExportFormatType.Excel
rExpOpts.FormatOptions = New ExcelFormatOptions

If strquery <> "" Then
rpt1.RecordSelectionFormula = strquery
End If

Dim rExpReqContext As New ExportRequestContext


rExpReqContext.ExportInfo = rExpOpts
str = rpt1.FormatEngine.ExportToStream(rExpReqContext)
Dim bArray As Byte()
ReDim bArray(str.Length)
str.Read(bArray, 0, str.Length)
Response.ClearContent()
Response.ClearHeaders()
Response.Expires = -1
Response.AppendHeader("content-disposition", "attachment;
filename=" + name)
Response.AppendHeader("Cache-Control", "no-cache")
Response.AppendHeader("Pragma", "no-cache")
Response.ContentType = cntype
Response.BinaryWrite(bArray)
Response.Flush()
Response.Close()
sri_007
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top