Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

File error: data may have been lost - when opening SSRS exported report to excel with barcode image

$
0
0

Hi,

I have a report where I have added code:

Public Function Convert(Text As String) As Byte()

           Dim b As System.Drawing.Bitmap

        '   Dim bar As New BarcodeLib.Barcode

           bar.Alignment = BarcodeLib.AlignmentPositions.LEFT

           bar.IncludeLabel = True

           bar.RotateFlipType = Drawing.RotateFlipType.RotateNoneFlipNone

           b = bar.Encode(BarcodeLib.TYPE.CODE128, Text, 400, 50)

           Dim bitmapData As Byte() = Nothing

           Using ms As New System.IO.MemoryStream()

               b.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)

               bitmapData = ms.ToArray()

           End Using

           Return bitmapData

       End Function

references and a barcode image to a report and this function:

=Code.Convert(Fields!IC_LOT_NUMBER.Value)

This works great exporting to PDF or word, but when I export to excel I get the error File error: data may have been lost. The file opens, but the barcode is gone. I tried changing the MIME type to Jpeg, gif, etc, but still I get this error.

Does anyone have any idea why this doesn't work or if there is a workaround?

Thanks,

Trish


Trish Leppa



Viewing all articles
Browse latest Browse all 28687


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>