sql-server-2008 - 当我将包含 .jpg 图像的报表导出到 MS Word 时,为什么有时会在 Reporting Services 中出现错误

标签 sql-server-2008 reporting-services ms-word jpeg

使用 SQL Server Reporting Services 2008 (SP1) 创建使用 .jpg 图像的报表时,有时在将报表导出到 word 时会出现以下错误。

Index was outside the bounds of the array. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Exception: Index was outside the bounds of the array.

最佳答案

与 Microsoft 支持人员(一位名叫 Mikael Ljunghorn 的乐于助人的小伙子)讨论过这个问题,这似乎与您在报告中使用的 .jpg 图像是否使用“渐进”编码进行编码有关。

为防止发生这种情况,请尽量避免在报告中使用渐进式编码的 .jpg 图像。

Mikael 还建议使用以下解决方法将 jpg 图像转换为 png 以避免 Word 中的转换问题:

1)
通过“报告”>“报告属性”>“代码”窗口添加此自定义代码块。

函数 ConvertToPNG(ByVal bytes As Byte()) As Byte() Dim inStream 作为新的 System.IO.MemoryStream(bytes) 调暗 bmp 作为新的 System.Drawing.Bitmap(inStream) 将 outStream 调暗为新 System.IO.MemoryStream() bmp.Save(outStream,System.Drawing.Imaging.ImageFormat.PNG) 返回outStream.GetBuffer() 结束函数

2)
在此调用中包装数据库图像值表达式:=Code.ConvertToPNG(Fields!ImageBlobField.Value)

关于sql-server-2008 - 当我将包含 .jpg 图像的报表导出到 MS Word 时,为什么有时会在 Reporting Services 中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1443208/

相关文章:

sql - 查询以查明外键是否在数据库中的其他位置被引用

sql - 生成随机SQL Server 2008时间测试数据

.net - .NET 程序中的分布式事务(MS-DTC 配置?!?)还是通过链接服务器在存储过程中?

reporting-services - Reporting Services - 计算列值(如果等于 A)

sql-server - SSRS : How to repeat header row of a table on each page that is embedded in a LIST?

c# - 使用 MsiGetProductInfo 检查是否安装了 Microsoft Word

ios - 无法从 iOS Word 应用程序将 MS Word 文档复制到我的应用程序

sql - 如何用单引号包裹我的查询输出

vba - 将制表位转换/替换为逗号

reporting-services - 在 Blazor 服务器应用程序中显示 SSRS 报告(免费)