简体   繁体   English

SSRS报告导出到Excel时颜色会发生变化

[英]SSRS Report Colours change when exporting to excel

When we export an SSRS 2008 report to excel and then copy a range from that file to another excel file, the colours used in the report are changed to something that is totally different, very annoying when we use 'Conditonal Formatting' to colour some of these cells a specific colour. 当我们将SSRS 2008报告导出到excel然后将该文件中的范围复制到另一个excel文件时,报告中使用的颜色会更改为完全不同的颜色,当我们使用“条件格式”对某些颜色进行着色时非常烦人这些细胞具有特定的颜色。 Any ideas why? 有什么想法吗?

It is because MS started using Excel's custom color palette with SQL Server 2008 instead of the built-in colors. 这是因为MS开始使用Excel的自定义调色板与SQL Server 2008而不是内置颜色。 Problem is exactly as you are describing that when copy & pasting colors from one sheet to another you lose the formatting. 问题正如您所描述的那样,当将颜色从一个工作表复制并粘贴到另一个工作表时,您将丢失格式。 Unfortunately: No way around that. 不幸的是:没办法。

See this post: Excel Export copy to another excel discoloration issue for SSRS 2008 请参阅此文章: Excel导出副本到SSRS 2008的另一个excel变色问题

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=386055 https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=386055

Suggestion from the SSRS team (in the above link/post) Posted by Microsoft on 5/29/2011 at 3:34 PM The API for COM/.NET is similar. 来自SSRS团队的建议(在上面的链接/帖子中)由Microsoft发布2011年5月29日下午3:34 COM / .NET的API类似。 You're calling Worksheet.Copy, which does not provide these options. 您正在调用Worksheet.Copy,它不提供这些选项。 Take a look at Range.Copy and Range.PasteSpecial. 看看Range.Copy和Range.PasteSpecial。

Anyone having link to any C# code for using Range.Copy or PasteSpecial calls to copy from one workbook/sheet to another workbook? 任何人都有链接到任何C#代码使用Range.Copy或PasteSpecial调用从一个工作簿/工作表复制到另一个工作簿?

I suppose the KeepSourceFormat or KeepSOurceScheme would be the trick to copy the sheet from one workbook to another to avoid the dis-color issue in SSRS 2008 R2 Excel report. 我认为KeepSourceFormat或KeepSOurceScheme是将工作表从一个工作簿复制到另一个工作簿的技巧,以避免SSRS 2008 R2 Excel报告中的dis-color问题。

If you need only to copy and paste it from one file to another, you cant just ctrl+C and ctrl+P. 如果你只需要将它从一个文件复制并粘贴到另一个文件,你就不能只按ctrl + C和ctrl + P. Ctrl+C works fine, but because of something, you need to right click and in Paste options you need to roll down Paste special and find Keep source formating button. Ctrl + C工作正常,但由于某些原因,您需要右键单击并在粘贴选项中需要向下滚动粘贴特殊并找到保持源格式化按钮。 It works for me because it keeps all colours and formating except size of cells. 它对我有用,因为它保留了除细胞大小以外的所有颜色和形成。

This Worked for me. 这对我有用。

=IIF(sum(Fields!TotalHours.Value) <> "", "White","Pink") 

in other words make sure you define the colors for both conditions. 换句话说,请确保为两个条件定义颜色。 Then on the Tablix1 Properties page under the Background fill color remove the "Automatic" and choose No color 然后在背景填充颜色下的Tablix1属性页面上删除“自动”并选择无颜色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM