本文介绍了RDLC 2008(VS2010)PDF渲染错误和不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近由VS2008项目转换为VS2010(因此RDLC 2005到2008)并将项目引用从报表查看器9.0更改为10.0,但是在尝试渲染报表时,(PDF格式)奇怪的是发生错误的地方"在本地报告处理过程中发生错误
。"与某些数据行发生。

I've recently converted by VS2008 project to VS2010 (and hence RDLC 2005 to 2008) and changed the project reference from report viewer 9.0 to 10.0, however when trying to render the report, (PDF format) strange thing happened where error "An error occurred during local report processing." occurs with some of the datarows.

该异常如下所示:

我设计应用程序的方式是每行数据生成1个报告,事情变得奇怪,并非所有数据都会生成此异常,异常只会从少数几个引发数据行。同样的项目与VS2008(RDLC2005)很好地配合,
VS2010和RDLC 2008有什么问题?

I've design the application in such a way that each row of data generates 1 report and thing become strange that not all data generates this exception, exception only be thrown from a few rows of data. The same project work nicely with VS2008 (RDLC2005), what's wrong with VS2010 and RDLC 2008?

以下是我在VB中的部分代码:

Below is portion of my code in VB:

LoadReportData(DS)

Dim ReportBindingSource As New System.Windows.Forms.BindingSource(DS," JAC")

Dim ReportDS As New Microsoft.Reporting .WinForms.ReportDataSource(" JAC_Dataset",ReportBindingSource)

Dim ReportGenerator As New Microsoft.Reporting.WinForms.ReportViewer

ReportGenerator.LocalReport.DataSources.Add(ReportDS)
ReportGenerator.LocalReport.ReportEmbeddedResource = QUOT; JAC.rdlc"

LoadReportData(DS)
Dim ReportBindingSource As New System.Windows.Forms.BindingSource(DS, "JAC")
Dim ReportDS As New Microsoft.Reporting.WinForms.ReportDataSource("JAC_Dataset", ReportBindingSource)
Dim ReportGenerator As New Microsoft.Reporting.WinForms.ReportViewer
ReportGenerator.LocalReport.DataSources.Add(ReportDS)
ReportGenerator.LocalReport.ReportEmbeddedResource = "JAC.rdlc"

暗淡RemarkParam(0)作为ReportParameter

Dim RemarkParam(0) As ReportParameter

"强制插入此行。空值报告参数似乎不再为VS2010所接受了。
如果ParameterDocRemarks.Trim =""然后是ParameterDocRemarks =" - None - "
$


RemarkParam(0)= New ReportParameter(" Remarks",ParameterDocRemarks,True)

ReportGenerator.LocalReport.SetParameters(RemarkParam)

ReportGenerator.RefreshReport()



$
Dim warnings as Warning ()=无数
Dim streamids As String()= Nothing

Dim mimeType As String = Nothing

Dim encoding As String = Nothing

Dim extension As String = Nothing

Dim bytes As Byte()



试试

'Forced to insert this row. Null value report parameter seems not acceptable to VS2010 anymore
If ParameterDocRemarks.Trim = "" Then ParameterDocRemarks = "- None -"

RemarkParam(0) = New ReportParameter("Remarks", ParameterDocRemarks, True)
ReportGenerator.LocalReport.SetParameters(RemarkParam)
ReportGenerator.RefreshReport()


Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim bytes As Byte()

Try

     bytes = ReportGenerator.LocalReport.Render(" PDF",Nothing,mimeType,encoding,extension,streamids,warnings)

     bytes = ReportGenerator.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)

Catch ex As Exception

      MessageBox.Show(ex.Message)

结束尝试

Catch ex As Exception
     MessageBox.Show(ex.Message)
End Try

有没有人面对相同或有任何线索发生在那里?

Does anyone face the same or having any clue of what happening there?

非常感谢

VB

推荐答案

 

我网站上的3份报告,只有1失败并出现此错误。其他两个都很好,其中一个也使用子报告!

Of 3 reports in my website, only 1 fails with this error. The other 2 are fine and 1 of those uses sub-reports too!

失败的报告是最简单的 - 并且在我的vs2008 dev上运行正常。浏览器没有任何变化...猜测线索可能是在.NET版本 - 现在我是针对.NET4的目标,而以前我是针对.NET2。但是如果NET4
可以处理我的一些报告,那么可能问题出在其他地方....

The report that fails is the most simple- and still runs fine on my vs2008 dev. browser without any changes... Guess the clue could be in the .NET version- now I am targeting for .NET4 whereas previously I targeted .NET2. But If NET4 can handle some of my reports, then likely the problem is elsewhere....

也许vs2010报告控件可以不同地处理来自数据源的某些值。 ......我想知道某处是否有简明的变化清单?

Maybe the vs2010 report control handles certain values from the data source differently..... I wonder if there is a concise list of changes somewhere?

 

或者可能(由于此报告没有子报告 - 我需要以某种方式指定,而不是保留默认值,可能为null)。  这么多猜测!

Or maybe (as this report has NO sub report- I need to specify that somehow rather than leaving the default which might be null).  So much speculation!

 

Exception:
Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
  at System.IO.BinaryReader.ReadString()
  at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(BinaryReader reader, String& value, TypeCode& typeCode, Object& originalValue)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(PageContext pageContext, String& value, TypeCode& typeCode, Object& originalValue)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.GetOriginalValue(PageContext pageContext)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.RegisterTextBoxes(RPLWriter rplWriter, PageContext pageContext)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.Report.NextPage(RPLWriter rplWriter, Int32 page, Int32 totalPages)
  at Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing.GetNextPage(RPLReport& rplReport)
  at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
  at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)
  --- End of inner exception stack trace ---
  at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
  at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
  at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
  at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
  at ASP.report_aspx.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\xxxxxxxxxxx\report.aspx:line 355

 

 


这篇关于RDLC 2008(VS2010)PDF渲染错误和不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 23:43