簡體   English   中英

MS Reporting服務-如何傳遞單元格顏色

[英]MS Reporting services - How to pass cell color

我正在嘗試創建具有某些數據值的報告。 每個數據值的質量可以為“好”或“差”。 我想使用自定義C#數據提供程序對象通過數據集傳遞值顏色。 進入報表設計器后,我可以使用“ Fields!MyColumn.Value ”,它可以正常工作。 還有一個鍵入' Fields!MyColumn.Color '的選項,但是我不知道如何初始化它。 請幫忙。

這是一個代碼片段,用於將一些數據加載到報告中:

IDataReader dataReader = command.ExecuteReader();
  dataset.Tables["dtTable"].Load(dataReader);
  dataReader.Close();

  //provide local report information to viewer
  reportViewer.LocalReport.ReportEmbeddedResource =
       "Client.Reports.Reports.Sample.rdlc";

  //prepare report data sources
  ReportDataSource dsTable = new ReportDataSource();
  dsTable.Name = "dtTableData";
  dsTable.Value = dataset.Tables["dtTable"];
  reportViewer.LocalReport.DataSources.Add(dsTable);

我對這種情況不是很熟悉,但是似乎如果使用字符串,則應該能夠傳遞報表中“顏色”字段通常采用的任何內容。 任何字符串,例如“ #ffffff”或“ white”或類似“ = IIF(Fields!MyColumn.Value = 1,“ blue”,“ red”))的表達式。 如果需要整數,則應根據http://msdn.microsoft.com/zh-cn/library/ms145991.aspx進行設置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM