Hi All,
I am having issue while exporting rdlc report containing Unicode characters to pdf. when exported the data in Thai shown as garbage as below-
üĺüľ
it is actually
ลูกค้า
Data is showing correctly on webpage but when exported is show garbage data.
What I have tried:
This is what I've done so far-
Private Sub CreateReport(ByVal FileType As String, ByVal selectedFile As String, ByVal reportName As String)
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 deviceinfo As String = Nothing
Dim viewer As New Microsoft.Reporting.WebForms.ReportViewer()
Try
deviceinfo = "<DeviceInfo>" &
"<OutputFormat>" & FileType & "</OutputFormat>" &
"<PageWidth>13.15in</PageWidth>" &
"<PageHeight>9in</PageHeight>" &
"<MarginTop>0.5in</MarginTop>" &
"<MarginLeft>0.1in</MarginLeft>" &
"<MarginRight>0.1in</MarginRight>" &
"<MarginBottom>0.5in</MarginBottom>" &
"</DeviceInfo>"
Dim byteViewer As Byte() = rpt.LocalReport.Render(FileType, deviceinfo, mimeType, encoding, extension, streamids, warnings)
Response.Buffer = True
Response.Clear()
Response.ContentType = mimeType
Response.AddHeader("content-disposition", "attachment; filename=" & hdnCustomerId.Value.ToString() & " " & reportName & ".pdf")
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble())
Response.BinaryWrite(byteViewer)
Response.Flush()
Catch ex As Exception
LogTheException("Exception:" & ex.Message.ToString & ex.StackTrace().ToString(), ex,sSelfPath, "CreateReport")
End Try
End Sub
I have gone through this
LocalReport.Render Method (String, String, CreateStreamCallback, out Warning[]) (Microsoft.Reporting.WebForms) | Microsoft Docs[
^] and so many other links. I think issue might be in
Quote:
Response.BinaryWrite(byteViewer)
as it might not getting correct binary data from
Quote:
rpt.LocalReport.Render
Please help to resolve. Thanks