Reporting services 列出所有可用颜色的SSRS报告
我想构建一个SSRS报告,显示Visual Studio(BIDS?)中显示的web颜色托盘中的所有可用颜色(非自定义)。我假设这可以在代码中完成,可能需要参考System.Drawing.Color,但我无法找到一个好的方法来实现它。我目前正在使用SSRS2005 比如:Reporting services 列出所有可用颜色的SSRS报告,reporting-services,reportingservices-2005,Reporting Services,Reportingservices 2005,我想构建一个SSRS报告,显示Visual Studio(BIDS?)中显示的web颜色托盘中的所有可用颜色(非自定义)。我假设这可以在代码中完成,可能需要参考System.Drawing.Color,但我无法找到一个好的方法来实现它。我目前正在使用SSRS2005 比如: Color Name | [Color] | HTML code (bonus, not necessary) ----------------------------------------------------
Color Name | [Color] | HTML code (bonus, not necessary)
---------------------------------------------------------------
Black | [Black] | #000000
White | [White] | #ffffff
DimGray | [DimGray] | #
...
LimeGreen | [LimeGreen] | #
etc
我知道我可以手动构建这个,但我认为这将是一个很好的学习体验。对于任何对我如何解决这个问题感兴趣的人,我最终手动构建了一个简单的联合查询,将所有可用颜色作为数据源。这并不是一个巨大的损失,因为它为未来一些有趣的数据库驱动的配色方案打开了大门 数据源
--MainDS: manual list of colors in VS2005 system
Select 'Black' as [color_name] union all
Select 'White' union all
Select 'DimGray' union all
Select 'Gray' union all
Select 'DarkGray'
-- etc
显示颜色的HTML颜色代码
--MainDS: manual list of colors in VS2005 system
Select 'Black' as [color_name] union all
Select 'White' union all
Select 'DimGray' union all
Select 'Gray' union all
Select 'DarkGray'
-- etc
公共函数HTMLColor(我的颜色作为字符串)作为字符串
Dim COLORBJ As System.Drawing.Color=System.Drawing.Color.FromName(我的颜色)
返回String.Format(“#{0:X2}{1:X2}{2:X2}”),colorObj.R,colorObj.G,colorObj.B)
端函数
我从另一个堆栈问题中获得了此函数的内容:
布局
这使得将报告设置为一个简单的表变得很容易。对于3个原始列,我使用了以下值:
[Color name] = (value)=Fields!color_name.value
[Color] = (BackgroundColor)=Fields!color_name.value
[White*] = (BackgroundColor)=White
[HTML] = =Code.HTMLColor(Fields!color_name.Value)
我还增加了一列纯白色,这确实有助于看到一些较浅色调的细微差别