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
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