带Response.WriteFile的Crystal Report [英] Crystal Report with Response.WriteFile

查看:55
本文介绍了带Response.WriteFile的Crystal Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,



我想根据用户选择文件格式生成并保存Crystal Report(来自下拉列表。



  Dim  filename  As  字符串 = ds.Tables( 0 )。行( 0 )(  reportoutfile
Response.ContentType = applicaiton / octet-stream
Response.WriteFile(??)







第1行:reportoutfile是具有文件名的参数。

第3行:Response的参数是什么。 WriteFile?



我的报告路径应该在哪里?

解决方案

一般来说,如果需要任何文件下载以下代码可以做到这一点

  string  file_path = Server.MapPath( 〜/文件/ + FILE_NAME); 
HttpContext.Current.Response.ContentType = application / octet-stream;
HttpContext.Current.Response.AddHeader( Content-Disposition attachment; filename = \ + file_Name + \);
HttpContext.Current.Response.TransmitFile(file_path);
HttpContext.Current.Response.End();





对于水晶报告,我猜你需要借助Crystal Report查看器控件创建水晶报告文件。


Hello Everyone,

I want to Generate and Save a Crystal Report based on user selections file Format(from Drop down list.

Dim filename As String = ds.Tables(0).Rows(0)("reportoutfile")
Response.ContentType = "applicaiton/octet-stream"
Response.WriteFile(??)




Line 1: reportoutfile is Parameter having File name.
Line 3: What will be the parameter of Response.WriteFile?

And where should be path of my report?

解决方案

Generally if any file need to download the following code can do that

string file_path=Server.MapPath("~/files/"+file_name);
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=\"" + file_Name + "\"");
HttpContext.Current.Response.TransmitFile(file_path);
HttpContext.Current.Response.End();



For crystal report I guess you need to take help of Crystal Report viewer control to create crystal report file.


这篇关于带Response.WriteFile的Crystal Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆