1

We have this sub to load the Report (and display it in Print Layout Mode)

 rv.Reset()
 rv.LocalReport.DataSources.Clear()

 'Base setting
 Dim exeFolder = Application.StartupPath
 Dim reportPath = Path.Combine(exeFolder, "kensaku/rp_kensakukekka.rdlc")
 rv.ProcessingMode = ProcessingMode.Local
 rv.LocalReport.ReportEmbeddedResource = reportPath
 rv.LocalReport.ReportPath = reportPath
 rv.SetDisplayMode(DisplayMode.PrintLayout)

 'Data setting
 Dim rds As New ReportDataSource("booksearchprint", dataSource)

 rv.LocalReport.DataSources.Add(rds)

 'Refresh GUI
 rv.LocalReport.Refresh()
 rv.RefreshReport()

The dataSource is declared as: Private dataSource As List(Of stadVBBookSearch_Result)

The stadVBBookSearch_Result class is just a normal class with some String and Integer properties.

Everythings worked just fine until there are some special characters in the dataSource.

For example:

日本-貿易 /スポーツ用品 /コンテンツビジネス /玩具 /映画 /音楽 /ゴム /サッカー /自転車 /出版 /釣り /テニス /図書 /花火 /皮革 /プラスチック /貿易 /木材 /野球 /レクリエーション /ぬいぐるみ /テレビゲーム /知的財産
쬀ര꠰괰☰☀뤀쐰༰꘰툰☰☀대옰쐰༰폿렰촰뤰☰☀가뀰☰☀ꠀꐰ갰☰☀ꨀ갰꼰☰☀됀☰☀딀쐰ꬰﰰ☰☀렀옰뜰☰☀뜀쐰터☰☀쐀☰☀였쬰뤰☰☀저뜰☰☀케쨰팰☰☀툀ꬰ꼰☰☀휀뤰섰쐰꼰☰☀꠰괰☰☀꼰똰ꐰ☰☀괰꘰☰☀꼰꠰ﰰ

The japanese characters are well displayed, but those others characters caused an error while rendering the local report: Please see this image: Error

How to fix this issue ? I don't know if it is the encoding of the datasource or of the whole application.

Vinh VO
  • 695
  • 1
  • 5
  • 25
  • The MSDN documentation mentions nothing about encoding, so I would expect that the ReportDataSource does not do anything along those lines - your encoding issue is more than likely within the application/UI – vbnet3d Dec 14 '16 at 14:24
  • @vbnet3d Hi, I tried to print that strange characters out in a MessageBox and it's displayed nicely as the same of what we have in the DB... Could you please tell me more about encoding settings in the application/UI? – Vinh VO Dec 15 '16 at 01:58
  • According to https://msdn.microsoft.com/en-us/library/ms251839%28v=vs.90%29.aspx, you can pass encoding through the Render() method as an argument. It seems that you would want to set it to utf-8 or utf-16. – vbnet3d Dec 15 '16 at 15:15
  • I did find that msdn information, but I wonder also what to do with the returned byte() type? – Vinh VO Dec 16 '16 at 01:23
  • I finally switched from ReportViewer to Crystal Report and everything work like a charm, even faster in all process. Thanks. – Vinh VO Dec 21 '16 at 02:01

0 Answers0