利用微软平台生成报表,线性图,柱形图
生活随笔
收集整理的這篇文章主要介紹了
利用微软平台生成报表,线性图,柱形图
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
說來慚愧,以前的工作中一直借助第三方dll進行報表制作,比如線性圖,柱形圖. 因為現在工作的這家公司不允許隨便引入第三方dll,聽同事說起可以建rdl類型文件進行引入到winform窗體中,窗體上使用reportViewer控件進行關聯展示.下面是我今天摸索3個小時的結果分享.
第一步.
首先找到sql server 2012 如下圖所示:
按照向導進行下一步
后面可以默認點擊下一步下一步 完成項目設置.
選中項目名 添加新項 創建一個空的報表
拖動迷你圖 ?手動拉大圖標 邊框會自適應大小 區域內右鍵選中轉換成整個圖表 ?如下圖所示
?
?動態設置標題
選中線別,右鍵選擇序列化屬性
設置線別寬度.
winform 界面讀取rdl類型界面核心代碼如下:
try{string sql = @"SELECT id,RNAME,mark,AGE,WORKYEAR FROM dbo.Region";DataTable temp = SQLHelper.GetDataTable(sql, CommandType.Text, null);reportViewer1.LocalReport.ReportPath = AppDomain.CurrentDomain.BaseDirectory + "Report2.rdl";XmlDocument xmlDocument = new XmlDocument();xmlDocument.Load(reportViewer1.LocalReport.ReportPath);XmlNodeList nodeTemplet = xmlDocument.GetElementsByTagName("DataSet");string dataSetName = "";if (nodeTemplet != null) dataSetName = nodeTemplet.Item(0).Attributes[0].Value;reportViewer1.LocalReport.DataSources.Clear();reportViewer1.LocalReport.SetParameters(new ReportParameter("mark", "測試用RDL生成線性圖"));reportViewer1.LocalReport.DataSources.Add(new ReportDataSource(dataSetName, temp));this.reportViewer1.RefreshReport();}catch (Exception ex){MessageBox.Show(ex.Message);}?按字段進行統計
?
轉載于:https://www.cnblogs.com/gudaozi/p/6600022.html
總結
以上是生活随笔為你收集整理的利用微软平台生成报表,线性图,柱形图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 特斯拉已用上比亚迪刀片电池:车辆最快8月
- 下一篇: 001-Ansible-参考http:/