2012-07-24 56 views

回答

2

您可以使用下面的表达式中Image组件的图象 - 属性:

{StiImageHelper.GetImageFromObject(your_byte_array)} 
+2

我发现了!没有必要做任何额外的事情。我们可以将字节[]传递给stimulsoft,并将一个图像框放到报告中。它会自动放置图像。谢谢。 – Amin 2012-08-14 12:21:40

+1

@Amin,请将您的解决方案作为答案发布并接受它(如[常见问题解答](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)) – Steve 2012-09-17 14:23:37

+0

我提到没有必要做任何额外的事情。我们可以在报表设计步骤中放置一个ImageBox,并像我们为其他fields_text,number等一样将我们的byte []传递给Stimulsoft。 – Amin 2012-09-22 06:24:34

1

我有一个测试表所示:

enter image description here

,并像一个测试stimulsoft报告:

enter image description here

和下面的代码是我送PIC从SQL Server到stimulsoft,使该报告的PDF文件:

protected void btnPrint_Click(object sender, EventArgs e) 
    { 
     SqlCommand myCommand = new SqlCommand("SELECT * FROM Product_Pipe_QR", new SqlConnection("my connection string")); 
     SqlDataAdapter dataAdapter = new SqlDataAdapter(myCommand); 
     DataSet dataSet = new DataSet("QR"); 
     dataAdapter.Fill(dataSet); 

     StiReport stiReport = new StiReport(); 
     string path = "~/Report/Product/QR.mrt"; 
     stiReport.Load(Server.MapPath(path)); 

     stiReport.RegData(dataSet); 

     stiReport.Render(); 

     if (!Directory.Exists(Server.MapPath("~/Report/PDF"))) 
      Directory.CreateDirectory(Server.MapPath("~/Report/PDF")); 
     string ReportFileName = "Pipe_Report.pdf"; 
     stiReport.ExportDocument(StiExportFormat.Pdf, ReportFileName); 
     FileStream file = File.Open(ReportFileName, FileMode.Open); 
     Response.Clear(); 
     Response.AddHeader("Content-Disposition", "attachment; filename=" + ReportFileName); 
     Response.AddHeader("Content-Length", file.Length.ToString()); 
     Response.ContentType = "application/pdf"; 
     file.Close(); 
     Response.WriteFile(ReportFileName); 
    } 

两个UniqueSerialQRImage在stimulsoft字典是stringQRImage数据库是image type