加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

vb.net 水晶报表 导出Excel

发布时间:2020-12-16 22:37:55 所属栏目:大数据 来源:网络整理
导读:Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load Try p_strNendo = Session("p_strNendo") '?????CrystalReportViewerの????を設定 'crvShiwakecho.Height = Common_AppSet.g_intHRptViewerHeight 'crvShiwake
Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load Try p_strNendo = Session("p_strNendo") '?????CrystalReportViewerの????を設定 'crvShiwakecho.Height = Common_AppSet.g_intHRptViewerHeight 'crvShiwakecho.Width = Common_AppSet.g_intHRptViewerWidth '??????????に表示 Dim objDtbl As DataTable = Session("dsShiwakecho").Tables("dt21_Shiwakecho") Dim objCR As ReportDocument = New ReportDocument() objCR.Load(Common_AppSet.g_strReportTemplate & "rpt21_Shiwakecho.rpt") objCR.SetDataSource(objDtbl) 'crvShiwakecho.ToolPanelView = ToolPanelViewType.None crvShiwakecho.ReportSource = objCR '????????????に値を設定 Dim pfFields As New CrystalDecisions.Shared.ParameterFields Dim pfNendo As New CrystalDecisions.Shared.ParameterField Dim pvNendo As New CrystalDecisions.Shared.ParameterDiscreteValue pfNendo.ParameterFieldName = "prmNendo" pvNendo.Value = p_strNendo pfNendo.CurrentValues.Add(pvNendo) pfFields.Add(pfNendo) crvShiwakecho.ParameterFieldInfo = pfFields Dim opts As CrystalDecisions.Shared.DiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions() opts.DiskFileName = "C:PPPWebLoader234.xls" Dim myExportOptions As CrystalDecisions.Shared.ExportOptions = objCR.ExportOptions myExportOptions.DestinationOptions = opts myExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile Response.ContentType = "application/vnd.ms-excel" myExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel For i As Integer = 0 To pfFields.Count - 1 objCR.SetParameterValue(pfFields.Item(i).Name,pfFields.Item(i).CurrentValues) Next objCR.Export() Response.End() Catch ex As Exception Throw New Exception("仕訳帳の出力に失敗しました。" & vbCrLf & ex.StackTrace & vbCrLf & ex.Message) End Try End Sub

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读