〔winform〕
VB.NET
Private Sub ReportViewer1_RenderingBegin(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ReportViewer1.RenderingBegin
Dim info As FieldInfo
For Each extension In Me.ReportViewer1.LocalReport.ListRenderingExtensions()
If extension.Name = "PDF" Then
info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance Or BindingFlags.NonPublic)
info.SetValue(extension, False)
End If
Next
End Sub
C#
//string exportOption = "Excel";
//string exportOption = "Word";
string exportOption = "PDF";
RenderingExtension extension = reportViewer1.LocalReport.ListRenderingExtensions().ToList().Find(x => x.Name.Equals(exportOption, StringComparison.CurrentCultureIgnoreCase));
if (extension != null)
{
System.Reflection.FieldInfo fieldInfo = extension.GetType().GetField("m_isVisible", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
fieldInfo.SetValue(extension, false);
}
參考:
禁止ReportViewer工具栏上的导出按钮?
reportviewer禁止导出Excel按钮
ReportViewer - Hide PDF Export
ReportViewer 2010:how to hide pdf in export option in reportviewer
Hide (Disable) specific export option in ReportViewer from Export button
Hide (Disable) specific export option (Word / Excel / PDF) from Export button
2019年1月31日 星期四
2018年9月13日 星期四
[學習][RDLC] 報表頁數 依照群組分頁 Reset Page Number in RDLC Report by group
It can be done actually, but not without adding some custom code to the report:
Shared reportGroup as String
Shared newPage as Integer
Public Function ResetPageNumber(newGroup as String)
If Not (reportGroup = newGroup)
reportGroup = newGroup
newPage = 1
Else
newPage = newPage + 1
End If
Return newPage
End Function
Then in the footer, add text box for page number and make it's value:
= Code.ResetPageNumber(ReportItems!TextBoxWithYourGroupNameOrID.Value)
參考:https://stackoverflow.com/questions/23300494/reset-page-number-in-rdlc-report-by-group
https://www.codeproject.com/Questions/1195280/Resetting-page-number-if-group-changes-in-RDLC-rep
注意:
頁尾一次只能參考一個欄位,如需多欄位的話,可以在最內的群組做組合即可。
或者資料群已做好排序,只要按最內的群組做分頁也可以,因為會重新RESET。
2014年9月17日 星期三
[除錯] 在Win7以上版本OS,ReportViewer 匯出時會亂碼。
問題:
若是2008以下的Reportviewer在Win7環境以上匯出時會變亂碼,在XP則正常。
原因:
因為字型編碼改掉的關係。
解決:
RDLC 匯出PDF中文問題 [這個]
How do I use ReportViewer 2010 in Visual Studio 2008 project?
ReportViewer Exoprt to PDF 出現亂碼 in WIN7
廠商的reporting servicen所作出的檔案無法險示或亂碼
若是2008以下的Reportviewer在Win7環境以上匯出時會變亂碼,在XP則正常。
原因:
因為字型編碼改掉的關係。
解決:
RDLC 匯出PDF中文問題 [這個]
How do I use ReportViewer 2010 in Visual Studio 2008 project?
ReportViewer Exoprt to PDF 出現亂碼 in WIN7
廠商的reporting servicen所作出的檔案無法險示或亂碼
2013年8月21日 星期三
[學習] RDLC原生導出Excel之功能, 發生「忽略資料表/矩陣資料格中的子報表」
問題:
Subreports within table/matrix cells are ignored.
忽略資料表/矩陣資料格中的子報表
ReportViewer導出EXCEL時:(PDF則不會...)
解決:(就是不要把子報表放入Table或Matrix裡)
紅框:List
綠框:Table
黃框:SubReport
RDLC解決設計
最外框:List
紅框:Table1
楬框:SubReport
黃框:Table2
需要注意Table1底線(Bottom)與SubReport頂線(Top)不可重疊
同上SupReport的底線(Bottom)與Table2的頂線(Top)不可重疊
解決後導出EXCEL的結果:
(若導出PDF, 則當sub-report沒資料時, tb1與tb2之間的sub-report會消失,
故會畫二條的黑線[tb1的bottomBorderLine+tb2的topBorderLine], 比原本圖示的黑線約2倍,
這是因為tb1與subReport的距離隔0.001+SubRerpot與tb2的距離隔0.001)
若有發生如上之問題, 則把距離隔弄小就不會了!
不管用LIST/矩形,呈現上還是有缺陷
報表最佳呈現解法:先將資料預先處理好,在丟進到報表
參考:(用LIST or 矩形...)
VS2008
RDLC 9.0.0.0
如何在ReportingService報表樣板檔中嵌入子報表,卻又能匯出成Excel?
Reporting Services子報表導出EXCEL問題
rdlc 报表 矩阵 详解 分组、总计、表头、显示方向、序号
rdlc导出Excel时 显示"忽略表/矩阵单元内的数据区域
报表显示时列名显示忽略表/矩阵单元内的数据区域
RDLC SubReports Exporting to Excel Are Ignored
匯出至 Microsoft Excel (報表產生器 3.0 和 SSRS)
Reporting Service Export to Excel Problem
Subreports within table/matrix cells are ignored.
May try for tools to convert PDF to excel format.
Drop the table control from rdlc and Put your main report data into matrix control and put your sub reports below to maix control. Run your report and export again.It will be solved.
To be able to export SRS reports using Sub-reports to Excel, it is advisable to use List controls instead of Data Table. Once you have made this little change, the export to excel is just perfect. Infact it will automatically even freeze the rows in the page header so that when you scroll through the data that was included in the report header stays static.
第三方Dll檔_Aspose.Cells for Reporting Services
Subreports within table/matrix cells are ignored.
忽略資料表/矩陣資料格中的子報表
ReportViewer導出EXCEL時:(PDF則不會...)
解決:(就是不要把子報表放入Table或Matrix裡)
I created a List, placed the main table from the primary report in the list.
Below the table, but inside the List I placed the subreport.
Because the subreport is not inside the table, it will render in Excel.
RDLC原本設計Below the table, but inside the List I placed the subreport.
Because the subreport is not inside the table, it will render in Excel.
紅框:List
綠框:Table
黃框:SubReport
RDLC解決設計
最外框:List
紅框:Table1
楬框:SubReport
黃框:Table2
需要注意Table1底線(Bottom)與SubReport頂線(Top)不可重疊
同上SupReport的底線(Bottom)與Table2的頂線(Top)不可重疊
解決後導出EXCEL的結果:
(若導出PDF, 則當sub-report沒資料時, tb1與tb2之間的sub-report會消失,
故會畫二條的黑線[tb1的bottomBorderLine+tb2的topBorderLine], 比原本圖示的黑線約2倍,
這是因為tb1與subReport的距離隔0.001+SubRerpot與tb2的距離隔0.001)
若有發生如上之問題, 則把距離隔弄小就不會了!
不管用LIST/矩形,呈現上還是有缺陷
報表最佳呈現解法:先將資料預先處理好,在丟進到報表
參考:(用LIST or 矩形...)
VS2008
RDLC 9.0.0.0
如何在ReportingService報表樣板檔中嵌入子報表,卻又能匯出成Excel?
Reporting Services子報表導出EXCEL問題
rdlc 报表 矩阵 详解 分组、总计、表头、显示方向、序号
rdlc导出Excel时 显示"忽略表/矩阵单元内的数据区域
报表显示时列名显示忽略表/矩阵单元内的数据区域
RDLC SubReports Exporting to Excel Are Ignored
匯出至 Microsoft Excel (報表產生器 3.0 和 SSRS)
Reporting Service Export to Excel Problem
Subreports within table/matrix cells are ignored.
May try for tools to convert PDF to excel format.
Drop the table control from rdlc and Put your main report data into matrix control and put your sub reports below to maix control. Run your report and export again.It will be solved.
To be able to export SRS reports using Sub-reports to Excel, it is advisable to use List controls instead of Data Table. Once you have made this little change, the export to excel is just perfect. Infact it will automatically even freeze the rows in the page header so that when you scroll through the data that was included in the report header stays static.
第三方Dll檔_Aspose.Cells for Reporting Services
2013年7月22日 星期一
[技巧] ReportViewer 動態改變TableRow是否顯示(或隱藏)
目的:
當某些欄位的值為0(或空白, 或其它條件)時, 則將此TableRow隱藏
解決:
「透過動態改變TableRow的Visibility」
選擇某個TableRow -> 屬性 -> Visibility -> 運算式
1) 一個欄位來決定Visibility
=iif(Fields!加班補貼.Value=0,true,false)
2) 二個欄位來決定Visibility
=iif(Fields!效率獎金.Value=0,iif(Fields!所得稅.Value=0,true,false),false)
3) N個欄位來決定Visibility
......
參考:
當某些欄位的值為0(或空白, 或其它條件)時, 則將此TableRow隱藏
解決:
「透過動態改變TableRow的Visibility」
選擇某個TableRow -> 屬性 -> Visibility -> 運算式
1) 一個欄位來決定Visibility
=iif(Fields!加班補貼.Value=0,true,false)
2) 二個欄位來決定Visibility
=iif(Fields!效率獎金.Value=0,iif(Fields!所得稅.Value=0,true,false),false)
3) N個欄位來決定Visibility
......
參考:
2013年3月20日 星期三
[學習] ReportViewer Drill-Through Reports 鑽研報表 (大陸譯:钻取报表)
主體屬性 與 報表屬性
報表規格A4紙 21寬 29.7長
邊界都為0
CODE:使用 自定義事件 DemoDrillthroughEventHandler
CODE:使用報表事件 ReportViewer1_Drillthrough
步驟:
STEP1.
各自建立報表 report1.rdlc & report2.rdlc 及報表來源
注意:
報表來源不可以有沒使用到的數據來源
不然會一直出錯,沒有 DataSet_dt 數據來源
STEP2.
在父報表Report2設定
欄位導覽 跳至報表Report1 (所要鑽取的報表)
並設定要給予的參數(Report_Parameter_3 參數值 是此欄位的值)
(此參數在 Report1 及 Report2 參數名稱要相同)
範例畫面:
主(父)報表Report2
鑽取下的報表Report1
延伸:
若有多個欄位 鑽研不同的Report
則...
延伸:
若要多筆資料分頁
則...
Step1.將設計的Table(無資料列 只留表頭或表尾) 拉進 List裡
Step2.設定List屬性
顯示畫面:
自己想的報表:(應該滿多人會被這樣要求的, 不然紙張很浪費!!)
這一張報表剛好佔A4紙3分之1頁面
今天我想把三筆資料弄在同一張頁面
解決方式1:(很笨的方式)
查詢的資料結合,將每三筆資料結合成一組。
例如:
原始DataSet From DataBase
SN 名字 地址
1 陳 屏
2 張 桃
......
n n n n
自定義DataSet, 每三筆組成一筆, 透過原始 DataSet 來組合
群組 row1 row2 row3 row4 row5 row6 row7 row8 row9
1 1 陳 屏 2 張 桃 3 x x
2 4 x x 5 x x 6 x x
......
n n-2 x x n-1 x x n x x
同一個List,同樣的表格畫三個,並分別放入 row1~row9
第一個表格 row1~row3 第二個表格 row4~row6 第三個表格 row7~row9
分頁設定則是依 "群組" 來分頁
若資料剛好不足3筆成一個record時
則沒資料列的地方要補空白
不然格式會跑掉
而且畫出來的格式 如果有顏色
則必須再報表設計時 設定如果沒有值 得border為白色
(1.不知從程式有沒有辦法處理 報表的設定)
(2.不要用hiden 因為格式也會跑掉)
當然如果紙張不是白色的 就依那個顏色
(1.就嘿嘿嘿...囧 自己慢慢選顏色, 缺點...)
解決方法2:結尾的分頁符號不要勾選
顯示畫面:
注意:
A4紙直式輸出 會自動弄三頁
A4紙橫式輸出 會自動弄二頁
若要輸出為中一刀 寬21 長14
則報表上也要設計為中一刀格式
否則輸出依然是A4格式輸出
中一刀設定
參考:
Create Drill-Through Reports using ReportViewer in ASP.NET 2.0
ReportViewer教程(14)-钻取报表和传入参数
ReportViewer.Drillthrough 事件
使用RDLC报表(四)--钻取式报表
RDLC研取子报表
MSDN報表教學 - 加入鑽研報表
MSDN報表教學 - 第 5 課:加入傳遞至鑽研報表的參數
ReportViewer Control 相關的 Sample Code
如何控制reportviewer驅動RDLC一筆記錄呈現一頁
Reporting Services
Beginning SQL Server 2005 Reporting Services Part 1
Beginning SQL Server 2005 Reporting Services Part 2
Beginning SQL Server 2005 Reporting Services Part 3: The Chart Control
Beginning SQL Server Reporting Services Part 4
RDL(C) Report Design Step by Step 2: SubReport <-- 這不是鑽研式報表
LocalReport.SubreportProcessing 事件 <-- 這不是鑽研式報表
ReportViewer SubReport 子報表
Difficulty setting ReportParameter
使用 PIVOT 和 UNPIVOT 讓資料多列變成一列
SQL - 使用 PIVOT
SQL資料轉行
續:SQL 資料轉行
待解決的設計: 思考一下別人的報表 如果是我要如何去設計...
請問該如何利用Report Viewer製作如內文所述報表?
報表規格A4紙 21寬 29.7長
邊界都為0
CODE:使用 自定義事件 DemoDrillthroughEventHandler
Imports Microsoft.Reporting.WinForms
Public Class Printer_Salary
Private orderDetailsData As DataTable = Nothing
Function LoadOrderDetailsData(ByVal a As String) As DataTable
Dim salaryM As New Class_conn(ConnRegNfunction.connMode, _
ConnRegNfunction.連線字串Local, _
ConnRegNfunction.連線字串WebUri)
Dim salaryDT = salaryM.DataTable("SELECT s.*,e.zhFname + e.zhName as 姓名,b.account FROM dbo.salaryM as s left join dbo.employee as e on s.staff_sn = e.staff_sn left join dbo.bank as b on s.staff_sn = b.staff_sn where s.staff_sn = " & a & " and s.ym = " & ComboBox3.Text.Trim & ComboBox2.Text.Trim & " and s.第幾次發薪 = " & TextBox1.Text.Trim & "", Nothing, Nothing)
salaryM.Dispose()
Return salaryDT
End Function
Private Sub DemoDrillthroughEventHandler(ByVal sender As System.Object, ByVal e As DrillthroughEventArgs)
Dim myLocalReport As LocalReport
myLocalReport = e.Report
orderDetailsData = LoadOrderDetailsData(myLocalReport.GetParameters()("Report_Parameter_3").Values(0).Trim)
myLocalReport.DataSources.Add(New ReportDataSource("yiTestDataSet_salaryM1", orderDetailsData))
End Sub
Private Sub Printer_Salary_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ReportViewer1.RefreshReport()
End Sub
Private Sub Printer_Salary_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
Dim month() As String = {"01", "02", "03", "04", "05", "06", _
"07", "08", "09", "10", "11", "12"}
ComboBox2.Items.AddRange(month)
For i As Integer = 2010 To Integer.Parse(Now.Date.Year.ToString)
ComboBox3.Items.Add(i)
Next
ComboBox3.Text = Now.Date.Year.ToString
ComboBox3.DropDownStyle = ComboBoxStyle.DropDown
ComboBox3.AutoCompleteMode = AutoCompleteMode.SuggestAppend
ComboBox3.AutoCompleteSource = AutoCompleteSource.ListItems
ComboBox2.Text = Now.Date.Month.ToString("00")
ComboBox2.DropDownStyle = ComboBoxStyle.DropDown
ComboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend
ComboBox2.AutoCompleteSource = AutoCompleteSource.ListItems
ComboBox1.SelectedIndex = 0
Call Button1_Click(Me, Nothing)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim salaryM As New Class_conn(ConnRegNfunction.connMode, _
ConnRegNfunction.連線字串Local, _
ConnRegNfunction.連線字串WebUri)
Dim salaryDT = salaryM.DataTable("SELECT s.*,e.zhFname + e.zhName as 姓名,b.account FROM dbo.salaryM as s left join dbo.employee as e on s.staff_sn = e.staff_sn left join dbo.bank as b on s.staff_sn = b.staff_sn where s.ym = " & ComboBox3.Text.Trim & ComboBox2.Text.Trim & " and s.第幾次發薪 = " & TextBox1.Text.Trim & "", Nothing, Nothing)
Dim rds As ReportDataSource = New ReportDataSource("yiTestDataSet_salaryM", salaryDT)
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(rds)
Dim rp1 As ReportParameter = _
New ReportParameter("Report_Parameter_0", ComboBox3.Text.Trim)
Dim rp2 As ReportParameter = _
New ReportParameter("Report_Parameter_1", ComboBox2.Text.Trim)
Dim rp3 As ReportParameter = _
New ReportParameter("Report_Parameter_2", TextBox1.Text.Trim)
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {rp1})
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {rp2})
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {rp3})
AddHandler ReportViewer1.Drillthrough, AddressOf DemoDrillthroughEventHandler
ReportViewer1.RefreshReport()
salaryM.Dispose()
End Sub
End Class
CODE:使用報表事件 ReportViewer1_Drillthrough
Imports Microsoft.Reporting.WinForms
Public Class Printer_Salary
Private orderDetailsData As DataTable = Nothing
Function LoadOrderDetailsData(ByVal a As String) As DataTable
Dim salaryM As New Class_conn(ConnRegNfunction.connMode, _
ConnRegNfunction.連線字串Local, _
ConnRegNfunction.連線字串WebUri)
Dim salaryDT = salaryM.DataTable("SELECT s.*,e.zhFname + e.zhName as 姓名,b.account FROM dbo.salaryM as s left join dbo.employee as e on s.staff_sn = e.staff_sn left join dbo.bank as b on s.staff_sn = b.staff_sn where s.staff_sn = " & a & " and s.ym = " & ComboBox3.Text.Trim & ComboBox2.Text.Trim & " and s.第幾次發薪 = " & TextBox1.Text.Trim & "", Nothing, Nothing)
salaryM.Dispose()
Return salaryDT
End Function
Private Sub Printer_Salary_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ReportViewer1.RefreshReport()
End Sub
Private Sub Printer_Salary_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
Dim month() As String = {"01", "02", "03", "04", "05", "06", _
"07", "08", "09", "10", "11", "12"}
ComboBox2.Items.AddRange(month)
For i As Integer = 2010 To Integer.Parse(Now.Date.Year.ToString)
ComboBox3.Items.Add(i)
Next
ComboBox3.Text = Now.Date.Year.ToString
ComboBox3.DropDownStyle = ComboBoxStyle.DropDown
ComboBox3.AutoCompleteMode = AutoCompleteMode.SuggestAppend
ComboBox3.AutoCompleteSource = AutoCompleteSource.ListItems
ComboBox2.Text = Now.Date.Month.ToString("00")
ComboBox2.DropDownStyle = ComboBoxStyle.DropDown
ComboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend
ComboBox2.AutoCompleteSource = AutoCompleteSource.ListItems
ComboBox1.SelectedIndex = 0
Call Button1_Click(Me, Nothing)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim salaryM As New Class_conn(ConnRegNfunction.connMode, _
ConnRegNfunction.連線字串Local, _
ConnRegNfunction.連線字串WebUri)
Dim salaryDT = salaryM.DataTable("SELECT s.*,e.zhFname + e.zhName as 姓名,b.account FROM dbo.salaryM as s left join dbo.employee as e on s.staff_sn = e.staff_sn left join dbo.bank as b on s.staff_sn = b.staff_sn where s.ym = " & ComboBox3.Text.Trim & ComboBox2.Text.Trim & " and s.第幾次發薪 = " & TextBox1.Text.Trim & "", Nothing, Nothing)
Dim rds As ReportDataSource = New ReportDataSource("yiTestDataSet_salaryM", salaryDT)
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(rds)
Dim rp1 As ReportParameter = _
New ReportParameter("Report_Parameter_0", ComboBox3.Text.Trim)
Dim rp2 As ReportParameter = _
New ReportParameter("Report_Parameter_1", ComboBox2.Text.Trim)
Dim rp3 As ReportParameter = _
New ReportParameter("Report_Parameter_2", TextBox1.Text.Trim)
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {rp1})
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {rp2})
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {rp3})
ReportViewer1.RefreshReport()
salaryM.Dispose()
End Sub
Private Sub ReportViewer1_Drillthrough(ByVal sender As System.Object, ByVal e As Microsoft.Reporting.WinForms.DrillthroughEventArgs) Handles ReportViewer1.Drillthrough
Dim myLocalReport As LocalReport
myLocalReport = e.Report
'If orderDetailsData Is Nothing Then'
orderDetailsData = LoadOrderDetailsData(myLocalReport.GetParameters()("Report_Parameter_3").Values(0).Trim)
'End If'
myLocalReport.DataSources.Add(New ReportDataSource("yiTestDataSet_salaryM1", orderDetailsData))
End Sub
End Class
步驟:
STEP1.
各自建立報表 report1.rdlc & report2.rdlc 及報表來源
注意:
報表來源不可以有沒使用到的數據來源
不然會一直出錯,沒有 DataSet_dt 數據來源
STEP2.
在父報表Report2設定
欄位導覽 跳至報表Report1 (所要鑽取的報表)
並設定要給予的參數(Report_Parameter_3 參數值 是此欄位的值)
(此參數在 Report1 及 Report2 參數名稱要相同)
範例畫面:
主(父)報表Report2
鑽取下的報表Report1
延伸:
若有多個欄位 鑽研不同的Report
則...
Select Case e.ReportPath
Case "Parent"
Me.List_Customers_OrderTotalTableAdapter.Fill(Me.MyDataSet1.List_Customers_OrderTotal)
RptrDS = New ReportDataSource("DataSet_1", Me.MyDataSet1.Tables("List_Customers_OrderTotal"))
Case "Level1"
Me.Show_OrderDetailsTableAdapter.Fill(Me.MyDataSet1.Show_OrderDetails, Integer.Parse(sParameter))
RptrDS = New ReportDataSource("DataSet_2", Me.MyDataSet1.Tables("Show_OrderDetails"))
Case "Level2"
Me.Show_ProductsTableAdapter.Fill(Me.MyDataSet1.Show_Products, Integer.Parse(sParameter))
RptrDS = New ReportDataSource("DataSet_3", Me.MyDataSet1.Tables("Show_Products"))
Case Else
Me.List_Customers_OrderTotalTableAdapter.Fill(Me.MyDataSet1.List_Customers_OrderTotal)
RptrDS = New ReportDataSource("DataSet_1", Me.MyDataSet1.Tables("List_Customers_OrderTotal"))
End Select
延伸:
若要多筆資料分頁
則...
Step1.將設計的Table(無資料列 只留表頭或表尾) 拉進 List裡
Step2.設定List屬性
顯示畫面:
自己想的報表:(應該滿多人會被這樣要求的, 不然紙張很浪費!!)
這一張報表剛好佔A4紙3分之1頁面
今天我想把三筆資料弄在同一張頁面
解決方式1:(很笨的方式)
查詢的資料結合,將每三筆資料結合成一組。
例如:
原始DataSet From DataBase
SN 名字 地址
1 陳 屏
2 張 桃
......
n n n n
自定義DataSet, 每三筆組成一筆, 透過原始 DataSet 來組合
群組 row1 row2 row3 row4 row5 row6 row7 row8 row9
1 1 陳 屏 2 張 桃 3 x x
2 4 x x 5 x x 6 x x
......
n n-2 x x n-1 x x n x x
同一個List,同樣的表格畫三個,並分別放入 row1~row9
第一個表格 row1~row3 第二個表格 row4~row6 第三個表格 row7~row9
分頁設定則是依 "群組" 來分頁
若資料剛好不足3筆成一個record時
則沒資料列的地方要補空白
不然格式會跑掉
而且畫出來的格式 如果有顏色
則必須再報表設計時 設定如果沒有值 得border為白色
(1.不知從程式有沒有辦法處理 報表的設定)
(2.不要用hiden 因為格式也會跑掉)
當然如果紙張不是白色的 就依那個顏色
(1.就嘿嘿嘿...囧 自己慢慢選顏色, 缺點...)
解決方法2:結尾的分頁符號不要勾選
顯示畫面:
注意:
A4紙直式輸出 會自動弄三頁
A4紙橫式輸出 會自動弄二頁
若要輸出為中一刀 寬21 長14
則報表上也要設計為中一刀格式
否則輸出依然是A4格式輸出
中一刀設定
參考:
Create Drill-Through Reports using ReportViewer in ASP.NET 2.0
ReportViewer教程(14)-钻取报表和传入参数
ReportViewer.Drillthrough 事件
使用RDLC报表(四)--钻取式报表
RDLC研取子报表
MSDN報表教學 - 加入鑽研報表
MSDN報表教學 - 第 5 課:加入傳遞至鑽研報表的參數
ReportViewer Control 相關的 Sample Code
如何控制reportviewer驅動RDLC一筆記錄呈現一頁
Reporting Services
Beginning SQL Server 2005 Reporting Services Part 1
Beginning SQL Server 2005 Reporting Services Part 2
Beginning SQL Server 2005 Reporting Services Part 3: The Chart Control
Beginning SQL Server Reporting Services Part 4
RDL(C) Report Design Step by Step 2: SubReport <-- 這不是鑽研式報表
LocalReport.SubreportProcessing 事件 <-- 這不是鑽研式報表
ReportViewer SubReport 子報表
Difficulty setting ReportParameter
使用 PIVOT 和 UNPIVOT 讓資料多列變成一列
SQL - 使用 PIVOT
SQL資料轉行
續:SQL 資料轉行
待解決的設計: 思考一下別人的報表 如果是我要如何去設計...
請問該如何利用Report Viewer製作如內文所述報表?
2013年1月23日 星期三
[技巧] ReportViewer 動態改變字型大小 change/modify dyanamically/programmatically rdlc font/size
原因:
當某些欄位的文字長度超過rdlc設計時的文字方塊大小
列印時欄位便會自動擴大,因而造成報表跑位(拉長或拉寬) or 多出一頁的錯誤
解決:
透過動態改變字型大小即可解決
在文字方塊 - 屬性 - Font - FontSize 運算式
=iif(Len(Parameters!Report_Parameter_0.Value)>= 200,10,12) & "pt"
當參數值Report_Parameter_0 經過 Len()函式 運算出來的 字串長度 > 200 時
設定字型為 10pt Else 設定字型為 12pt
當某些欄位的文字長度超過rdlc設計時的文字方塊大小
列印時欄位便會自動擴大,因而造成報表跑位(拉長或拉寬) or 多出一頁的錯誤
解決:
透過動態改變字型大小即可解決
在文字方塊 - 屬性 - Font - FontSize 運算式
=iif(Len(Parameters!Report_Parameter_0.Value)>= 200,10,12) & "pt"
當參數值Report_Parameter_0 經過 Len()函式 運算出來的 字串長度 > 200 時
設定字型為 10pt Else 設定字型為 12pt
它解:
一、載入rdlc前,改修rdlc(xml)
二、寫在 rdlc code
訂閱:
文章 (Atom)








