作成日: 2025/12/09 最終更新日: 2025/12/09
文書種別
不具合
状況
回避方法あり
詳細
セクションレポートのPictureに画像を読み込んだとき、以下の例外が発生する場合があります。
System.IO.EndOfStreamException
HResult=0x80070026
Message=ストリームの終わりを超えて読み取ることはできません。
Source=mscorlib
回避方法
System.Drawing.Imageクラスに画像を読み込んでからPictureに設定してください。
Dim rpt = New GrapeCity.ActiveReports.SectionReport()
Using xtr As New System.Xml.XmlTextReader("Sample.rpx")
rpt.LoadLayout(xtr)
End Using
'PictureにSystem.Drawing.Imageを設定
Dim Picture1 = DirectCast(rpt.Sections("Detail").Controls("Picture1"), GrapeCity.ActiveReports.SectionReportModel.Picture)
Using fs As New FileStream("Sample.png", System.IO.FileMode.Open, System.IO.FileAccess.Read)
Picture1.Image = System.Drawing.Image.FromStream(fs)
End Using
'画像を埋め込んだrpxファイルを保存
Using xtr As New System.Xml.XmlTextWriter("Sample_image.rpx", Nothing)
rpt.SaveLayout(xtr)
End Using