WPF / MVVM应用程序中的RDLC报告。如何显示外部图像

时间:2018-12-17 16:13:29

标签: wpf image external rdlc

我正在尝试从WPF / MVVM应用程序运行RDLC报告,并将其保存到文件夹中。 报告包含一个外部图像,其来源由传递给报告的数据集字段设置(=“ file:\” + First(Fields!LOGO.Value,“ DS_LOGO”))。 这是我用来生成报告的代码

Dim lr As New Microsoft.Reporting.WebForms.LocalReport
lr.ReportPath="\\remoteServer\MyApp\reports\rdlc\TEST.rdlc"
lr.DataSources.Clear()
For Each dt As DataTable In ds.Tables
   lr.DataSources.Add(New Microsoft.Reporting.WebForms.ReportDataSource(dt.TableName, dt))   'DS_LOGO
Next

Dim PathDoc = "\\remoteServer\MyApp\reports\pdf\TEST.pdf"

Try
 lr.EnableExternalImages = True
 lr.Refresh()

 Dim bytes = lr.Render("PDF", "")

 Using fs As New System.IO.FileStream(PathDoc, System.IO.FileMode.Create)
      fs.Write(bytes, 0, bytes.Length)
      fs.Close()
 End Using
Catch ex As Exception
End Try

在输出报告中未显示外部图像,并且调试会产生thees错误消息

Warning: Le immagini con riferimenti a URL esterni non verranno visualizzate se il report viene pubblicato in un server di report senza un account UnattendedExecutionAccount o se per le immagini di destinazione non è consentito l'accesso anonimo. (rsWarningFetchingExternalImages)
Warning: Il valore della proprietà MIMEType per l'oggetto ‘Image1’ di tipo image è “application/octet-stream”, che non è una proprietà MIMEType valida. (rsInvalidMIMEType)
Warning: Il valore della proprietà ImageData per l'oggetto ‘Image1’ di tipo image è “”, che non è una proprietà ImageData valida. (rsInvalidExternalImageProperty)

我试图从Web应用程序运行该报告,并且它可以工作。 我必须如何设置WPF才能使其正常工作?谢谢

0 个答案:

没有答案