将水晶报告导出为特定文件夹中的pdf格式。 [英] Export crystal report to pdf format in the particular folder.
问题描述
亲爱的所有 Dear All 这篇关于将水晶报告导出为特定文件夹中的pdf格式。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
我想将水晶报告导出为pdf格式。
以下代码有效。
唯一的问题是如何指定保存文件的文件夹。
< pre lang =c#> protected void Button1_Click( object sender,EventArgs e)
{
test.Load(Server.MapPath( tiredata.rpt跨度>));
mydbconn mycon = new mydbconn();
mycon.DBCreate();
DataSet3 dsobj = new DataSet3();
string query = SELECT serialno FROM TIM_TIRE_SIZE;
OracleDataAdapter myOracleDataAdapter1 = new OracleDataAdapter(query,mycon.conn);
myOracleDataAdapter1.Fill(dsobj, tbl3);
test.SetDataSource(dsobj);
CrystalReportViewer1.ReportSource = test;
CrystalReportViewer1.DataBind();
oStream =(MemoryStream)
test.ExportToStream(ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer = true ;
Response.ContentType = application / pdf;
Response.BinaryWrite(oStream.ToArray());
ExportFormatType formatType = ExportFormatType.NoFormat;
formatType = ExportFormatType.PortableDocFormat;
test.ExportToHttpResponse(formatType,Response, true , 吉瑞跨度>);
Response.End();
oStream.Close();
mycon.DBclose();
ClientScript.RegisterStartupScript(GetType(), 消息, < SCRIPT LANGUAGE ='javascript'> alert('ok');< / script> );
} 你不能。在服务器上运行的代码无法控制客户端保存文件的位置 - 甚至是什么。
在你问之前,不,没有解决方法。如果有,那将是一个主要的安全漏洞。
I want to export crystal report to pdf format.
Following code works.
Only thing is how can I specify the folder to save the file.
protected void Button1_Click(object sender, EventArgs e)
{
test.Load(Server.MapPath("tiredata.rpt"));
mydbconn mycon = new mydbconn();
mycon.DBCreate();
DataSet3 dsobj = new DataSet3();
string query = "SELECT serialno FROM TIM_TIRE_SIZE ";
OracleDataAdapter myOracleDataAdapter1 = new OracleDataAdapter(query, mycon.conn);
myOracleDataAdapter1.Fill(dsobj, "tbl3");
test.SetDataSource(dsobj);
CrystalReportViewer1.ReportSource = test;
CrystalReportViewer1.DataBind();
oStream = (MemoryStream)
test.ExportToStream(ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
ExportFormatType formatType = ExportFormatType.NoFormat;
formatType = ExportFormatType.PortableDocFormat;
test.ExportToHttpResponse(formatType, Response, true, "giri");
Response.End();
oStream.Close();
mycon.DBclose();
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('ok');</script>");
}
You can't. Code running on the server has no control over where - or even if - the client saves a file.
And before you ask, no, there is no workaround. If there was, it would be a major security vulnerability.