顯示具有 報表 標籤的文章。 顯示所有文章
顯示具有 報表 標籤的文章。 顯示所有文章

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。

2013年8月21日 星期三

[學習] RDLC原生導出Excel之功能, 發生「忽略資料表/矩陣資料格中的子報表」

問題:
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原本設計
紅框: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
......

參考: