我尝试以图片格式保存我的localreport。但我发现DeviceInfo
的{{1}}设置不起作用。
ColorDepth
独立于 string mime, encoding, fileNameExtension;
string[] streams;
Warning[] warnings;
byte[] bytes = report.Render("IMAGE", @"<DeviceInfo><OutputFormat>TIFF</OutputFormat><ColorDepth>8</ColorDepth><StartPage>0</StartPage></DeviceInfo>", out mime, out encoding, out fileNameExtension, out streams, out warnings);
FileStream fs = new FileStream("C:\\imgRep.tiff", FileMode.OpenOrCreate);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
值,结果为ColorDepth
= 24的.tiff文件。
有谁知道如何解决这个错误?
我将这些字节转换为另一个ColorDepth
:
PixelFormat
但我不确定这是一个好的决定..
答案 0 :(得分:2)
根据SQL Server Books Online TIFF图像,您从报告中呈现的图像将始终保存为当前版本的24位。
For this release of SQL Server, the value of this setting is ignored, and the TIFF image is always rendered as 24-bit.
由于ReportViewer / LocalReport只是客户端使用SQL Server Reporting Services,因此您将受到相同的限制。
虽然他们说ColorDepth只支持TIFF图像,但有点好奇,在下一句中他们说当前版本中的设置被忽略了,自SQL Server 2005以来一直如此。