SSRS Report Colours change when exporting to excel

末鹿安然 提交于 2019-12-08 19:21:02

问题


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. Any ideas why?


回答1:


It is because MS started using Excel's custom color palette with SQL Server 2008 instead of the built-in colors. 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




回答2:


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. You're calling Worksheet.Copy, which does not provide these options. Take a look at Range.Copy and 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?

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.




回答3:


If you need only to copy and paste it from one file to another, you cant just ctrl+C and 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. It works for me because it keeps all colours and formating except size of cells.




回答4:


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



来源:https://stackoverflow.com/questions/4204139/ssrs-report-colours-change-when-exporting-to-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!