使用 Active 报告工具使用反射生成报告时出现异常。我正在粘贴我得到的日志和代码。 代码
Protected Function GetReportStream(ByVal ActiveReportObject As Object) As Byte()
Try
ActiveReportObject.GetType().GetMethod("Run", New System.Type() {System.Type.GetType("System.Boolean")}).Invoke(ActiveReportObject, New Object() {False})
Catch
End Try
'' Create a memory stream to save the report document in RDF format.
Dim memStream As New System.IO.MemoryStream()
Dim document As Object = ActiveReportObject.GetType().GetProperty("Document").GetValue(ActiveReportObject, Nothing)
document.GetType().GetMethod("Save", New System.Type() {System.Type.GetType("System.IO.Stream")}).Invoke(document, New Object() {memStream})
''Create a byte array buffer to read the memory stream.
Dim outBytes As Byte() = memStream.GetBuffer()
memStream.Flush()
memStream.Close()
Return outBytes
End Function
日志
enter code here
System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
System.Drawing.ImageConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType)
DataDynamics.ActiveReports.Document.RawImageResourceData.FromImage(Image image)
#ar.ResourceManager.#U.#sKg.#gIc()
#ar.ResourceManager.#opk(Object sender, #Iok e)
#ar.GenericCache`3.#fOe(TKey k, Boolean purging)
#ar.ResourceManager.#zg(#ib resource)
DataDynamics.ActiveReports.Document.Page.#Df(Int16 fileVersion, BinaryWriter recordWriter, Hashtable savedResources, List`1 ownedResourceIds, List`1 referencedResourceIds)
DataDynamics.ActiveReports.Document.Page.Save(BinaryWriter writer, Int16 fileVersion, Hashtable savedResources)
DataDynamics.ActiveReports.Document.PagesCollection.Save(BinaryWriter writer, Int16 fileVersion, SaveOptions options)